Skip to content

Commit

Permalink
fix typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Jun 11, 2022
1 parent 395e2b1 commit 8e9cdbc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 6 additions & 10 deletions packages/docusaurus-plugin-content-docs/src/client/index.ts
Expand Up @@ -85,7 +85,7 @@ export const useAllDocsData = (): {[pluginId: string]: GlobalPluginData} =>
}
| undefined) ?? StableEmptyObject;

export const useDocsData = (pluginId: string | undefined): GlobalPluginData =>
export const useDocsData = (pluginId?: string): GlobalPluginData =>
usePluginData('docusaurus-plugin-content-docs', pluginId, {
failfast: true,
}) as GlobalPluginData;
Expand Down Expand Up @@ -117,12 +117,12 @@ export function useActivePluginAndVersion(
}

/** Versions are returned ordered (most recent first). */
export function useVersions(pluginId: string | undefined): GlobalVersion[] {
export function useVersions(pluginId?: string): GlobalVersion[] {
const data = useDocsData(pluginId);
return data.versions;
}

export function useLatestVersion(pluginId: string | undefined): GlobalVersion {
export function useLatestVersion(pluginId?: string): GlobalVersion {
const data = useDocsData(pluginId);
return getLatestVersion(data);
}
Expand All @@ -131,17 +131,13 @@ export function useLatestVersion(pluginId: string | undefined): GlobalVersion {
* Returns `undefined` on doc-unrelated pages, because there's no version
* currently considered as active.
*/
export function useActiveVersion(
pluginId: string | undefined,
): GlobalVersion | undefined {
export function useActiveVersion(pluginId?: string): GlobalVersion | undefined {
const data = useDocsData(pluginId);
const {pathname} = useLocation();
return getActiveVersion(data, pathname);
}

export function useActiveDocContext(
pluginId: string | undefined,
): ActiveDocContext {
export function useActiveDocContext(pluginId?: string): ActiveDocContext {
const data = useDocsData(pluginId);
const {pathname} = useLocation();
return getActiveDocContext(data, pathname);
Expand All @@ -150,7 +146,7 @@ export function useActiveDocContext(
* Useful to say "hey, you are not on the latest docs version, please switch"
*/
export function useDocVersionSuggestions(
pluginId: string | undefined,
pluginId?: string,
): DocVersionSuggestions {
const data = useDocsData(pluginId);
const {pathname} = useLocation();
Expand Down
2 changes: 2 additions & 0 deletions website/tsconfig.json
Expand Up @@ -28,6 +28,8 @@
"noUnusedParameters": false,
"importsNotUsedAsValues": "remove",

"moduleResolution": "NodeNext",

// This is important. We run `yarn tsc` in website so we can catch issues
// with our declaration files (mostly names that are forgotten to be
// imported, invalid semantics...). Because we don't have end-to-end type
Expand Down

0 comments on commit 8e9cdbc

Please sign in to comment.