mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 16:59:06 +02:00
refactor: replace non-prop interface with type; allow plugin lifecycles to have sync type (#7080)
* refactor: replace non-prop interface with type; allow plugin lifecycles to have sync type * fix
This commit is contained in:
parent
ce2b631455
commit
24c205a835
38 changed files with 145 additions and 138 deletions
|
@ -341,31 +341,31 @@ type PluginVersionInformation =
|
|||
| {readonly type: 'local'}
|
||||
| {readonly type: 'synthetic'};
|
||||
|
||||
interface SiteMetadata {
|
||||
type SiteMetadata = {
|
||||
readonly docusaurusVersion: string;
|
||||
readonly siteVersion?: string;
|
||||
readonly pluginVersions: Record<string, PluginVersionInformation>;
|
||||
}
|
||||
};
|
||||
|
||||
interface I18nLocaleConfig {
|
||||
type I18nLocaleConfig = {
|
||||
label: string;
|
||||
direction: string;
|
||||
}
|
||||
};
|
||||
|
||||
interface I18n {
|
||||
type I18n = {
|
||||
defaultLocale: string;
|
||||
locales: [string, ...string[]];
|
||||
currentLocale: string;
|
||||
localeConfigs: Record<string, I18nLocaleConfig>;
|
||||
}
|
||||
};
|
||||
|
||||
interface DocusaurusContext {
|
||||
type DocusaurusContext = {
|
||||
siteConfig: DocusaurusConfig;
|
||||
siteMetadata: SiteMetadata;
|
||||
globalData: Record<string, unknown>;
|
||||
i18n: I18n;
|
||||
codeTranslations: Record<string, string>;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
Usage example:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue