refactor: fix a lot of errors in type-aware linting (#7477)

This commit is contained in:
Joshua Chen 2022-05-24 15:40:26 +08:00 committed by GitHub
parent 222bf3c091
commit bf1513a3e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
120 changed files with 407 additions and 364 deletions

View file

@ -126,6 +126,6 @@ export function getDocVersionSuggestions(
const latestVersion = getLatestVersion(data);
const activeDocContext = getActiveDocContext(data, pathname);
const latestDocSuggestion: GlobalDoc | undefined =
activeDocContext?.alternateDocVersions[latestVersion.name];
activeDocContext.alternateDocVersions[latestVersion.name];
return {latestDocSuggestion, latestVersionSuggestion: latestVersion};
}

View file

@ -34,9 +34,11 @@ const StableEmptyObject = {};
// In blog-only mode, docs hooks are still used by the theme. We need a fail-
// safe fallback when the docs plugin is not in use
export const useAllDocsData = (): {[pluginId: string]: GlobalPluginData} =>
(useAllPluginInstancesData('docusaurus-plugin-content-docs') as {
[pluginId: string]: GlobalPluginData;
}) ?? StableEmptyObject;
(useAllPluginInstancesData('docusaurus-plugin-content-docs') as
| {
[pluginId: string]: GlobalPluginData;
}
| undefined) ?? StableEmptyObject;
export const useDocsData = (pluginId: string | undefined): GlobalPluginData =>
usePluginData('docusaurus-plugin-content-docs', pluginId, {