@docusaurus/module-type-aliases 2.0.0-beta.16 → 2.0.0-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/index.d.ts +52 -45
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/module-type-aliases",
3
- "version": "2.0.0-beta.16",
3
+ "version": "2.0.0-beta.19",
4
4
  "description": "Docusaurus module type aliases.",
5
5
  "types": "./src/index.d.ts",
6
6
  "publishConfig": {
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/docusaurus-module-type-aliases"
13
13
  },
14
14
  "dependencies": {
15
- "@docusaurus/types": "2.0.0-beta.16",
15
+ "@docusaurus/types": "2.0.0-beta.19",
16
16
  "@types/react": "*",
17
17
  "@types/react-router-config": "*",
18
18
  "@types/react-router-dom": "*",
@@ -23,5 +23,5 @@
23
23
  "react-dom": "*"
24
24
  },
25
25
  "license": "MIT",
26
- "gitHead": "eb43c4d4f95a4fb97dc9bb9dc615413e0dc2e1e7"
26
+ "gitHead": "a71e60a49cce93c1006ef10c41ac03187f057102"
27
27
  }
package/src/index.d.ts CHANGED
@@ -20,65 +20,54 @@ declare module '@generated/docusaurus.config' {
20
20
  }
21
21
 
22
22
  declare module '@generated/site-metadata' {
23
- import type {DocusaurusSiteMetadata} from '@docusaurus/types';
23
+ import type {SiteMetadata} from '@docusaurus/types';
24
24
 
25
- const siteMetadata: DocusaurusSiteMetadata;
25
+ const siteMetadata: SiteMetadata;
26
26
  export = siteMetadata;
27
27
  }
28
28
 
29
29
  declare module '@generated/registry' {
30
- const registry: {
31
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
- readonly [key: string]: [() => Promise<any>, string, string];
33
- };
30
+ import type {Registry} from '@docusaurus/types';
31
+
32
+ const registry: Registry;
34
33
  export default registry;
35
34
  }
36
35
 
37
36
  declare module '@generated/routes' {
38
- import type {RouteConfig} from 'react-router-config';
37
+ import type {RouteConfig as RRRouteConfig} from 'react-router-config';
39
38
 
40
- export type Route = {
41
- readonly path: string;
42
- readonly component: RouteConfig['component'];
43
- readonly exact?: boolean;
44
- readonly routes?: Route[];
39
+ type RouteConfig = RRRouteConfig & {
40
+ path: string;
45
41
  };
46
- const routes: Route[];
42
+ const routes: RouteConfig[];
47
43
  export default routes;
48
44
  }
49
45
 
50
46
  declare module '@generated/routesChunkNames' {
51
- import type {RouteChunksTree} from '@docusaurus/types';
47
+ import type {RouteChunkNames} from '@docusaurus/types';
52
48
 
53
- const routesChunkNames: Record<string, RouteChunksTree>;
49
+ const routesChunkNames: RouteChunkNames;
54
50
  export = routesChunkNames;
55
51
  }
56
52
 
57
53
  declare module '@generated/globalData' {
58
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
- const globalData: Record<string, any>;
54
+ import type {GlobalData} from '@docusaurus/types';
55
+
56
+ const globalData: GlobalData;
60
57
  export = globalData;
61
58
  }
62
59
 
63
60
  declare module '@generated/i18n' {
64
- const i18n: {
65
- defaultLocale: string;
66
- locales: [string, ...string[]];
67
- currentLocale: string;
68
- localeConfigs: Record<
69
- string,
70
- {
71
- label: string;
72
- direction: string;
73
- htmlLang: string;
74
- }
75
- >;
76
- };
61
+ import type {I18n} from '@docusaurus/types';
62
+
63
+ const i18n: I18n;
77
64
  export = i18n;
78
65
  }
79
66
 
80
67
  declare module '@generated/codeTranslations' {
81
- const codeTranslations: Record<string, string>;
68
+ import type {CodeTranslations} from '@docusaurus/types';
69
+
70
+ const codeTranslations: CodeTranslations;
82
71
  export = codeTranslations;
83
72
  }
84
73
 
@@ -98,8 +87,6 @@ declare module '@theme/Layout' {
98
87
 
99
88
  export interface Props {
100
89
  readonly children?: ReactNode;
101
- readonly title?: string;
102
- readonly description?: string;
103
90
  }
104
91
  export default function Layout(props: Props): JSX.Element;
105
92
  }
@@ -123,6 +110,10 @@ declare module '@theme/Root' {
123
110
  export default function Root({children}: Props): JSX.Element;
124
111
  }
125
112
 
113
+ declare module '@theme/SiteMetadata' {
114
+ export default function SiteMetadata(): JSX.Element;
115
+ }
116
+
126
117
  declare module '@docusaurus/constants' {
127
118
  export const DEFAULT_PLUGIN_ID: 'default';
128
119
  }
@@ -149,8 +140,9 @@ declare module '@docusaurus/Head' {
149
140
 
150
141
  declare module '@docusaurus/Link' {
151
142
  import type {CSSProperties, ComponentProps} from 'react';
143
+ import type {NavLinkProps as RRNavLinkProps} from 'react-router-dom';
152
144
 
153
- type NavLinkProps = Partial<import('react-router-dom').NavLinkProps>;
145
+ type NavLinkProps = Partial<RRNavLinkProps>;
154
146
  export type Props = NavLinkProps &
155
147
  ComponentProps<'a'> & {
156
148
  readonly className?: string;
@@ -160,7 +152,7 @@ declare module '@docusaurus/Link' {
160
152
  readonly href?: string;
161
153
  readonly autoAddBaseUrl?: boolean;
162
154
 
163
- // escape hatch in case broken links check is annoying for a specific link
155
+ /** Escape hatch in case broken links check doesn't make sense. */
164
156
  readonly 'data-noBrokenLinkCheck'?: boolean;
165
157
  };
166
158
  export default function Link(props: Props): JSX.Element;
@@ -174,10 +166,9 @@ declare module '@docusaurus/Interpolate' {
174
166
  ? Key | ExtractInterpolatePlaceholders<Rest>
175
167
  : never;
176
168
 
177
- export type InterpolateValues<
178
- Str extends string,
179
- Value extends ReactNode,
180
- > = Record<ExtractInterpolatePlaceholders<Str>, Value>;
169
+ export type InterpolateValues<Str extends string, Value extends ReactNode> = {
170
+ [key in ExtractInterpolatePlaceholders<Str>]: Value;
171
+ };
181
172
 
182
173
  // If all the values are plain strings, interpolate returns a simple string
183
174
  export function interpolate<Str extends string>(
@@ -250,6 +241,12 @@ declare module '@docusaurus/useDocusaurusContext' {
250
241
  export default function useDocusaurusContext(): DocusaurusContext;
251
242
  }
252
243
 
244
+ declare module '@docusaurus/useRouteContext' {
245
+ import type {PluginRouteContext} from '@docusaurus/types';
246
+
247
+ export default function useRouteContext(): PluginRouteContext;
248
+ }
249
+
253
250
  declare module '@docusaurus/useIsBrowser' {
254
251
  export default function useIsBrowser(): boolean;
255
252
  }
@@ -316,17 +313,20 @@ declare module '@docusaurus/renderRoutes' {
316
313
  }
317
314
 
318
315
  declare module '@docusaurus/useGlobalData' {
319
- export function useAllPluginInstancesData<T = unknown>(
316
+ import type {GlobalData, UseDataOptions} from '@docusaurus/types';
317
+
318
+ export function useAllPluginInstancesData(
320
319
  pluginName: string,
321
- ): Record<string, T>;
320
+ options?: UseDataOptions,
321
+ ): GlobalData[string] | undefined;
322
322
 
323
- export function usePluginData<T = unknown>(
323
+ export function usePluginData(
324
324
  pluginName: string,
325
325
  pluginId?: string,
326
- ): T;
326
+ options?: UseDataOptions,
327
+ ): GlobalData[string][string] | undefined;
327
328
 
328
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
329
- export default function useGlobalData(): Record<string, any>;
329
+ export default function useGlobalData(): GlobalData;
330
330
  }
331
331
 
332
332
  declare module '*.svg' {
@@ -346,3 +346,10 @@ declare module '*.css' {
346
346
  const src: string;
347
347
  export default src;
348
348
  }
349
+
350
+ interface Window {
351
+ docusaurus: {
352
+ prefetch: (url: string) => false | Promise<void[]>;
353
+ preload: (url: string) => false | Promise<void[]>;
354
+ };
355
+ }