refactor: minor type improvements (#7035)

This commit is contained in:
Joshua Chen 2022-03-28 11:15:37 +08:00 committed by GitHub
parent 755b03861c
commit c81d21a641
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 25 deletions

View file

@ -56,18 +56,9 @@ declare module '@generated/globalData' {
} }
declare module '@generated/i18n' { declare module '@generated/i18n' {
const i18n: { import type {I18n} from '@docusaurus/types';
defaultLocale: string;
locales: [string, ...string[]]; const i18n: I18n;
currentLocale: string;
localeConfigs: {
[localeName: string]: {
label: string;
direction: string;
htmlLang: string;
};
};
};
export = i18n; export = i18n;
} }

View file

@ -647,13 +647,11 @@ declare module '@docusaurus/plugin-content-docs/client' {
sidebars?: {[sidebarId: string]: GlobalSidebar}; sidebars?: {[sidebarId: string]: GlobalSidebar};
}; };
export type GlobalSidebarLink = { export type GlobalSidebar = {
link?: {
label: string; label: string;
path: string; path: string;
}; };
export type GlobalSidebar = {
link?: GlobalSidebarLink;
// ... we may add other things here later // ... we may add other things here later
}; };
export type GlobalPluginData = { export type GlobalPluginData = {

View file

@ -16,6 +16,7 @@
"test": "tsc -p ." "test": "tsc -p ."
}, },
"dependencies": { "dependencies": {
"@docusaurus/react-loadable": "5.5.2",
"react-loadable": "npm:@docusaurus/react-loadable@5.5.2", "react-loadable": "npm:@docusaurus/react-loadable@5.5.2",
"commander": "^5.1.0", "commander": "^5.1.0",
"history": "^4.9.0", "history": "^4.9.0",

View file

@ -10,7 +10,7 @@ import type {CustomizeRuleString} from 'webpack-merge/dist/types';
import type {CommanderStatic} from 'commander'; import type {CommanderStatic} from 'commander';
import type {ParsedUrlQueryInput} from 'querystring'; import type {ParsedUrlQueryInput} from 'querystring';
import type Joi from 'joi'; import type Joi from 'joi';
import type {Overwrite, DeepPartial} from 'utility-types'; import type {Overwrite, DeepPartial, DeepRequired} from 'utility-types';
import type {Location} from 'history'; import type {Location} from 'history';
import type Loadable from 'react-loadable'; import type Loadable from 'react-loadable';
@ -130,12 +130,7 @@ export type I18nConfig = {
localeConfigs: {[locale: string]: Partial<I18nLocaleConfig>}; localeConfigs: {[locale: string]: Partial<I18nLocaleConfig>};
}; };
export type I18n = { export type I18n = DeepRequired<I18nConfig> & {currentLocale: string};
defaultLocale: string;
locales: [string, ...string[]];
currentLocale: string;
localeConfigs: {[locale: string]: I18nLocaleConfig};
};
export type GlobalData = {[pluginName: string]: {[pluginId: string]: unknown}}; export type GlobalData = {[pluginName: string]: {[pluginId: string]: unknown}};