mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-30 09:27:04 +02:00
refactor: properly type docs version (#5284)
* Type docs version Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Move non-null assertions Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Test again
This commit is contained in:
parent
bc6c67720a
commit
0a668366c2
9 changed files with 66 additions and 29 deletions
|
@ -137,3 +137,32 @@ declare module '@theme/Seo' {
|
|||
const Seo: (props: Props) => JSX.Element;
|
||||
export default Seo;
|
||||
}
|
||||
|
||||
declare module '@theme/hooks/useDocs' {
|
||||
type GlobalPluginData = import('./types').GlobalPluginData;
|
||||
type GlobalVersion = import('./types').GlobalVersion;
|
||||
type ActivePlugin = import('./client/docsClientUtils').ActivePlugin;
|
||||
type ActiveDocContext = import('./client/docsClientUtils').ActiveDocContext;
|
||||
type DocVersionSuggestions = import('./client/docsClientUtils').DocVersionSuggestions;
|
||||
|
||||
export type {GlobalPluginData, GlobalVersion};
|
||||
export const useAllDocsData: () => Record<string, GlobalPluginData>;
|
||||
export const useDocsData: (pluginId?: string) => GlobalPluginData;
|
||||
export const useActivePlugin: (
|
||||
options: GetActivePluginOptions = {},
|
||||
) => ActivePlugin | undefined;
|
||||
export const useActivePluginAndVersion: (
|
||||
options: GetActivePluginOptions = {},
|
||||
) =>
|
||||
| {activePlugin: ActivePlugin; activeVersion: GlobalVersion | undefined}
|
||||
| undefined;
|
||||
export const useVersions: (pluginId?: string) => GlobalVersion[];
|
||||
export const useLatestVersion: (pluginId?: string) => GlobalVersion;
|
||||
export const useActiveVersion: (
|
||||
pluginId?: string,
|
||||
) => GlobalVersion | undefined;
|
||||
export const useActiveDocContext: (pluginId?: string) => ActiveDocContext;
|
||||
export const useDocVersionSuggestions: (
|
||||
pluginId?: string,
|
||||
) => DocVersionSuggestions;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue