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 43d0af3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 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
12 changes: 6 additions & 6 deletions yarn.lock
Expand Up @@ -3259,9 +3259,9 @@
integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==

"@tsconfig/docusaurus@^1.0.5":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@tsconfig/docusaurus/-/docusaurus-1.0.5.tgz#5298c5b0333c6263f06c3149b38ebccc9f169a4e"
integrity sha512-KM/TuJa9fugo67dTGx+ktIqf3fVc077J6jwHu845Hex4EQf7LABlNonP/mohDKT0cmncdtlYVHHF74xR/YpThg==
version "1.0.6"
resolved "https://registry.yarnpkg.com/@tsconfig/docusaurus/-/docusaurus-1.0.6.tgz#7305a7fa590decc0d5968500234e95fd68788978"
integrity sha512-1QxDaP54hpzM6bq9E+yFEo4F9WbWHhsDe4vktZXF/iDlc9FqGr9qlg+3X/nuKQXx8QxHV7ue8NXFazzajsxFBA==

"@types/babel__core@^7.1.14":
version "7.1.19"
Expand Down Expand Up @@ -15360,9 +15360,9 @@ vfile@^4.0.0:
vfile-message "^2.0.0"

vfile@^5.0.0:
version "5.3.2"
resolved "https://registry.yarnpkg.com/vfile/-/vfile-5.3.2.tgz#b499fbc50197ea50ad3749e9b60beb16ca5b7c54"
integrity sha512-w0PLIugRY3Crkgw89TeMvHCzqCs/zpreR31hl4D92y6SOE07+bfJe+dK5Q2akwS+i/c801kzjoOr9gMcTe6IAA==
version "5.3.3"
resolved "https://registry.yarnpkg.com/vfile/-/vfile-5.3.3.tgz#70b75779d99e0698a8cb6536a09361ac37f800a0"
integrity sha512-xwALvwUKmXzHOri5dGXqXNN8JDEvxPhf8avC+E+pJEl32e4/grLdRdsgx23HpK7QI0cwgR4+QfaM8D5KUnki3g==
dependencies:
"@types/unist" "^2.0.0"
is-buffer "^2.0.0"
Expand Down

0 comments on commit 43d0af3

Please sign in to comment.