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' {
const i18n: {
defaultLocale: string;
locales: [string, ...string[]];
currentLocale: string;
localeConfigs: {
[localeName: string]: {
label: string;
direction: string;
htmlLang: string;
};
};
};
import type {I18n} from '@docusaurus/types';
const i18n: I18n;
export = i18n;
}

View file

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

View file

@ -16,6 +16,7 @@
"test": "tsc -p ."
},
"dependencies": {
"@docusaurus/react-loadable": "5.5.2",
"react-loadable": "npm:@docusaurus/react-loadable@5.5.2",
"commander": "^5.1.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 {ParsedUrlQueryInput} from 'querystring';
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 Loadable from 'react-loadable';
@ -130,12 +130,7 @@ export type I18nConfig = {
localeConfigs: {[locale: string]: Partial<I18nLocaleConfig>};
};
export type I18n = {
defaultLocale: string;
locales: [string, ...string[]];
currentLocale: string;
localeConfigs: {[locale: string]: I18nLocaleConfig};
};
export type I18n = DeepRequired<I18nConfig> & {currentLocale: string};
export type GlobalData = {[pluginName: string]: {[pluginId: string]: unknown}};