@docusaurus/module-type-aliases 2.0.0-beta.20 → 2.0.0-beta.22

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 +7 -4
  2. package/src/index.d.ts +27 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/module-type-aliases",
3
- "version": "2.0.0-beta.20",
3
+ "version": "2.0.0-beta.22",
4
4
  "description": "Docusaurus module type aliases.",
5
5
  "types": "./src/index.d.ts",
6
6
  "publishConfig": {
@@ -12,16 +12,19 @@
12
12
  "directory": "packages/docusaurus-module-type-aliases"
13
13
  },
14
14
  "dependencies": {
15
- "@docusaurus/types": "2.0.0-beta.20",
15
+ "@docusaurus/react-loadable": "5.5.2",
16
+ "@docusaurus/types": "2.0.0-beta.22",
17
+ "@types/history": "^4.7.11",
16
18
  "@types/react": "*",
17
19
  "@types/react-router-config": "*",
18
20
  "@types/react-router-dom": "*",
19
- "react-helmet-async": "*"
21
+ "react-helmet-async": "*",
22
+ "react-loadable": "npm:@docusaurus/react-loadable@5.5.2"
20
23
  },
21
24
  "peerDependencies": {
22
25
  "react": "*",
23
26
  "react-dom": "*"
24
27
  },
25
28
  "license": "MIT",
26
- "gitHead": "ed5cdba401a5948e187e927039b142a0decc702d"
29
+ "gitHead": "daf9e462c4eebb7ac26a940932311f987e768f87"
27
30
  }
package/src/index.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  declare module '@generated/client-modules' {
9
9
  import type {ClientModule} from '@docusaurus/types';
10
10
 
11
- const clientModules: readonly (ClientModule & {default: ClientModule})[];
11
+ const clientModules: readonly (ClientModule & {default?: ClientModule})[];
12
12
  export default clientModules;
13
13
  }
14
14
 
@@ -35,9 +35,11 @@ declare module '@generated/registry' {
35
35
 
36
36
  declare module '@generated/routes' {
37
37
  import type {RouteConfig as RRRouteConfig} from 'react-router-config';
38
+ import type Loadable from 'react-loadable';
38
39
 
39
40
  type RouteConfig = RRRouteConfig & {
40
41
  path: string;
42
+ component: ReturnType<typeof Loadable>;
41
43
  };
42
44
  const routes: RouteConfig[];
43
45
  export default routes;
@@ -75,10 +77,9 @@ declare module '@theme-original/*';
75
77
  declare module '@theme-init/*';
76
78
 
77
79
  declare module '@theme/Error' {
78
- export interface Props {
79
- readonly error: Error;
80
- readonly tryAgain: () => void;
81
- }
80
+ import type {FallbackParams} from '@docusaurus/ErrorBoundary';
81
+
82
+ export interface Props extends FallbackParams {}
82
83
  export default function Error(props: Props): JSX.Element;
83
84
  }
84
85
 
@@ -120,18 +121,24 @@ declare module '@docusaurus/constants' {
120
121
 
121
122
  declare module '@docusaurus/ErrorBoundary' {
122
123
  import type {ReactNode} from 'react';
123
- import type ErrorComponent from '@theme/Error';
124
+
125
+ export type FallbackParams = {
126
+ readonly error: Error;
127
+ readonly tryAgain: () => void;
128
+ };
129
+
130
+ export type FallbackFunction = (params: FallbackParams) => JSX.Element;
124
131
 
125
132
  export interface Props {
126
- readonly fallback?: typeof ErrorComponent;
133
+ readonly fallback?: FallbackFunction;
127
134
  readonly children: ReactNode;
128
135
  }
129
136
  export default function ErrorBoundary(props: Props): JSX.Element;
130
137
  }
131
138
 
132
139
  declare module '@docusaurus/Head' {
133
- import type {HelmetProps} from 'react-helmet-async';
134
140
  import type {ReactNode} from 'react';
141
+ import type {HelmetProps} from 'react-helmet-async';
135
142
 
136
143
  export type Props = HelmetProps & {children: ReactNode};
137
144
 
@@ -315,16 +322,27 @@ declare module '@docusaurus/renderRoutes' {
315
322
  declare module '@docusaurus/useGlobalData' {
316
323
  import type {GlobalData, UseDataOptions} from '@docusaurus/types';
317
324
 
325
+ export function useAllPluginInstancesData(
326
+ pluginName: string,
327
+ options: {failfast: true},
328
+ ): GlobalData[string];
329
+
318
330
  export function useAllPluginInstancesData(
319
331
  pluginName: string,
320
332
  options?: UseDataOptions,
321
333
  ): GlobalData[string] | undefined;
322
334
 
335
+ export function usePluginData(
336
+ pluginName: string,
337
+ pluginId: string | undefined,
338
+ options: {failfast: true},
339
+ ): NonNullable<GlobalData[string][string]>;
340
+
323
341
  export function usePluginData(
324
342
  pluginName: string,
325
343
  pluginId?: string,
326
344
  options?: UseDataOptions,
327
- ): GlobalData[string][string] | undefined;
345
+ ): GlobalData[string][string];
328
346
 
329
347
  export default function useGlobalData(): GlobalData;
330
348
  }