@docusaurus/module-type-aliases 2.0.0-beta.2 → 2.0.0-beta.20
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.
- package/package.json +10 -6
- package/src/index.d.ts +180 -89
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/module-type-aliases",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.20",
|
|
4
4
|
"description": "Docusaurus module type aliases.",
|
|
5
5
|
"types": "./src/index.d.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -11,13 +11,17 @@
|
|
|
11
11
|
"url": "https://github.com/facebook/docusaurus.git",
|
|
12
12
|
"directory": "packages/docusaurus-module-type-aliases"
|
|
13
13
|
},
|
|
14
|
-
"
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@docusaurus/types": "2.0.0-beta.20",
|
|
15
16
|
"@types/react": "*",
|
|
16
|
-
"@types/react-helmet": "*",
|
|
17
|
-
"@types/react-loadable": "*",
|
|
18
17
|
"@types/react-router-config": "*",
|
|
19
|
-
"@types/react-router-dom": "*"
|
|
18
|
+
"@types/react-router-dom": "*",
|
|
19
|
+
"react-helmet-async": "*"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"react": "*",
|
|
23
|
+
"react-dom": "*"
|
|
20
24
|
},
|
|
21
25
|
"license": "MIT",
|
|
22
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "ed5cdba401a5948e187e927039b142a0decc702d"
|
|
23
27
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -6,118 +6,177 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
declare module '@generated/client-modules' {
|
|
9
|
-
|
|
9
|
+
import type {ClientModule} from '@docusaurus/types';
|
|
10
|
+
|
|
11
|
+
const clientModules: readonly (ClientModule & {default: ClientModule})[];
|
|
10
12
|
export default clientModules;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
declare module '@generated/docusaurus.config' {
|
|
14
|
-
|
|
16
|
+
import type {DocusaurusConfig} from '@docusaurus/types';
|
|
17
|
+
|
|
18
|
+
const config: DocusaurusConfig;
|
|
15
19
|
export default config;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
declare module '@generated/site-metadata' {
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
import type {SiteMetadata} from '@docusaurus/types';
|
|
24
|
+
|
|
25
|
+
const siteMetadata: SiteMetadata;
|
|
26
|
+
export = siteMetadata;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
declare module '@generated/registry' {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
import type {Registry} from '@docusaurus/types';
|
|
31
|
+
|
|
32
|
+
const registry: Registry;
|
|
27
33
|
export default registry;
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
declare module '@generated/routes' {
|
|
31
|
-
type
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
import type {RouteConfig as RRRouteConfig} from 'react-router-config';
|
|
38
|
+
|
|
39
|
+
type RouteConfig = RRRouteConfig & {
|
|
40
|
+
path: string;
|
|
35
41
|
};
|
|
36
|
-
const routes:
|
|
42
|
+
const routes: RouteConfig[];
|
|
37
43
|
export default routes;
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
declare module '@generated/routesChunkNames' {
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
import type {RouteChunkNames} from '@docusaurus/types';
|
|
48
|
+
|
|
49
|
+
const routesChunkNames: RouteChunkNames;
|
|
50
|
+
export = routesChunkNames;
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
declare module '@generated/globalData' {
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
import type {GlobalData} from '@docusaurus/types';
|
|
55
|
+
|
|
56
|
+
const globalData: GlobalData;
|
|
57
|
+
export = globalData;
|
|
48
58
|
}
|
|
49
59
|
|
|
50
60
|
declare module '@generated/i18n' {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
localeConfigs: Record<string, {label: string; direction: string}>;
|
|
56
|
-
};
|
|
57
|
-
export default i18n;
|
|
61
|
+
import type {I18n} from '@docusaurus/types';
|
|
62
|
+
|
|
63
|
+
const i18n: I18n;
|
|
64
|
+
export = i18n;
|
|
58
65
|
}
|
|
59
66
|
|
|
60
67
|
declare module '@generated/codeTranslations' {
|
|
61
|
-
|
|
62
|
-
export default codeTranslations;
|
|
63
|
-
}
|
|
68
|
+
import type {CodeTranslations} from '@docusaurus/types';
|
|
64
69
|
|
|
65
|
-
|
|
70
|
+
const codeTranslations: CodeTranslations;
|
|
71
|
+
export = codeTranslations;
|
|
72
|
+
}
|
|
66
73
|
|
|
67
74
|
declare module '@theme-original/*';
|
|
75
|
+
declare module '@theme-init/*';
|
|
76
|
+
|
|
77
|
+
declare module '@theme/Error' {
|
|
78
|
+
export interface Props {
|
|
79
|
+
readonly error: Error;
|
|
80
|
+
readonly tryAgain: () => void;
|
|
81
|
+
}
|
|
82
|
+
export default function Error(props: Props): JSX.Element;
|
|
83
|
+
}
|
|
68
84
|
|
|
69
|
-
declare module '@
|
|
85
|
+
declare module '@theme/Layout' {
|
|
86
|
+
import type {ReactNode} from 'react';
|
|
70
87
|
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
export interface Props {
|
|
89
|
+
readonly children?: ReactNode;
|
|
90
|
+
}
|
|
91
|
+
export default function Layout(props: Props): JSX.Element;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare module '@theme/Loading' {
|
|
95
|
+
import type {LoadingComponentProps} from 'react-loadable';
|
|
96
|
+
|
|
97
|
+
export default function Loading(props: LoadingComponentProps): JSX.Element;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare module '@theme/NotFound' {
|
|
101
|
+
export default function NotFound(): JSX.Element;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare module '@theme/Root' {
|
|
73
105
|
import type {ReactNode} from 'react';
|
|
74
106
|
|
|
75
|
-
export
|
|
107
|
+
export interface Props {
|
|
108
|
+
readonly children: ReactNode;
|
|
109
|
+
}
|
|
110
|
+
export default function Root({children}: Props): JSX.Element;
|
|
111
|
+
}
|
|
76
112
|
|
|
77
|
-
|
|
78
|
-
export default
|
|
113
|
+
declare module '@theme/SiteMetadata' {
|
|
114
|
+
export default function SiteMetadata(): JSX.Element;
|
|
79
115
|
}
|
|
80
116
|
|
|
81
|
-
declare module '@docusaurus/
|
|
117
|
+
declare module '@docusaurus/constants' {
|
|
118
|
+
export const DEFAULT_PLUGIN_ID: 'default';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
declare module '@docusaurus/ErrorBoundary' {
|
|
82
122
|
import type {ReactNode} from 'react';
|
|
123
|
+
import type ErrorComponent from '@theme/Error';
|
|
83
124
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
readonly
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
readonly children?: ReactNode;
|
|
91
|
-
readonly isActive?: (match: any, location: any) => boolean;
|
|
92
|
-
readonly autoAddBaseUrl?: boolean;
|
|
125
|
+
export interface Props {
|
|
126
|
+
readonly fallback?: typeof ErrorComponent;
|
|
127
|
+
readonly children: ReactNode;
|
|
128
|
+
}
|
|
129
|
+
export default function ErrorBoundary(props: Props): JSX.Element;
|
|
130
|
+
}
|
|
93
131
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export
|
|
132
|
+
declare module '@docusaurus/Head' {
|
|
133
|
+
import type {HelmetProps} from 'react-helmet-async';
|
|
134
|
+
import type {ReactNode} from 'react';
|
|
135
|
+
|
|
136
|
+
export type Props = HelmetProps & {children: ReactNode};
|
|
137
|
+
|
|
138
|
+
export default function Head(props: Props): JSX.Element;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
declare module '@docusaurus/Link' {
|
|
142
|
+
import type {CSSProperties, ComponentProps} from 'react';
|
|
143
|
+
import type {NavLinkProps as RRNavLinkProps} from 'react-router-dom';
|
|
144
|
+
|
|
145
|
+
type NavLinkProps = Partial<RRNavLinkProps>;
|
|
146
|
+
export type Props = NavLinkProps &
|
|
147
|
+
ComponentProps<'a'> & {
|
|
148
|
+
readonly className?: string;
|
|
149
|
+
readonly style?: CSSProperties;
|
|
150
|
+
readonly isNavLink?: boolean;
|
|
151
|
+
readonly to?: string;
|
|
152
|
+
readonly href?: string;
|
|
153
|
+
readonly autoAddBaseUrl?: boolean;
|
|
154
|
+
|
|
155
|
+
/** Escape hatch in case broken links check doesn't make sense. */
|
|
156
|
+
readonly 'data-noBrokenLinkCheck'?: boolean;
|
|
157
|
+
};
|
|
158
|
+
export default function Link(props: Props): JSX.Element;
|
|
99
159
|
}
|
|
100
160
|
|
|
101
161
|
declare module '@docusaurus/Interpolate' {
|
|
102
162
|
import type {ReactNode} from 'react';
|
|
103
163
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
164
|
+
export type ExtractInterpolatePlaceholders<Str extends string> =
|
|
165
|
+
Str extends `${string}{${infer Key}}${infer Rest}`
|
|
166
|
+
? Key | ExtractInterpolatePlaceholders<Rest>
|
|
167
|
+
: never;
|
|
108
168
|
|
|
109
|
-
export type InterpolateValues<
|
|
110
|
-
Str
|
|
111
|
-
|
|
112
|
-
> = Record<ExtractInterpolatePlaceholders<Str>, Value>;
|
|
169
|
+
export type InterpolateValues<Str extends string, Value extends ReactNode> = {
|
|
170
|
+
[key in ExtractInterpolatePlaceholders<Str>]: Value;
|
|
171
|
+
};
|
|
113
172
|
|
|
114
|
-
//
|
|
173
|
+
// If all the values are plain strings, interpolate returns a simple string
|
|
115
174
|
export function interpolate<Str extends string>(
|
|
116
175
|
text: Str,
|
|
117
176
|
values?: InterpolateValues<Str, string | number>,
|
|
118
177
|
): string;
|
|
119
178
|
|
|
120
|
-
// If values contain any ReactNode,
|
|
179
|
+
// If values contain any ReactNode, the return is a ReactNode
|
|
121
180
|
export function interpolate<Str extends string, Value extends ReactNode>(
|
|
122
181
|
text: Str,
|
|
123
182
|
values?: InterpolateValues<Str, Value>,
|
|
@@ -134,18 +193,23 @@ declare module '@docusaurus/Interpolate' {
|
|
|
134
193
|
}
|
|
135
194
|
|
|
136
195
|
declare module '@docusaurus/Translate' {
|
|
137
|
-
import type {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
196
|
+
import type {ReactNode} from 'react';
|
|
197
|
+
import type {InterpolateValues} from '@docusaurus/Interpolate';
|
|
198
|
+
|
|
199
|
+
// TS type to ensure that at least one of id or message is always provided
|
|
200
|
+
// (Generic permits to handled message provided as React children)
|
|
201
|
+
type IdOrMessage<
|
|
202
|
+
MessageKey extends 'children' | 'message',
|
|
203
|
+
Str extends string,
|
|
204
|
+
> =
|
|
205
|
+
| ({[key in MessageKey]: Str} & {id?: string})
|
|
206
|
+
| ({[key in MessageKey]?: Str} & {id: string});
|
|
141
207
|
|
|
142
|
-
export type TranslateParam<Str extends string> =
|
|
143
|
-
|
|
208
|
+
export type TranslateParam<Str extends string> = IdOrMessage<
|
|
209
|
+
'message',
|
|
210
|
+
Str
|
|
144
211
|
> & {
|
|
145
|
-
message: Str;
|
|
146
|
-
id?: string;
|
|
147
212
|
description?: string;
|
|
148
|
-
values?: InterpolateValues<Str, string | number>;
|
|
149
213
|
};
|
|
150
214
|
|
|
151
215
|
export function translate<Str extends string>(
|
|
@@ -153,9 +217,12 @@ declare module '@docusaurus/Translate' {
|
|
|
153
217
|
values?: InterpolateValues<Str, string | number>,
|
|
154
218
|
): string;
|
|
155
219
|
|
|
156
|
-
export type TranslateProps<Str extends string> =
|
|
157
|
-
|
|
220
|
+
export type TranslateProps<Str extends string> = IdOrMessage<
|
|
221
|
+
'children',
|
|
222
|
+
Str
|
|
223
|
+
> & {
|
|
158
224
|
description?: string;
|
|
225
|
+
values?: InterpolateValues<Str, ReactNode>;
|
|
159
226
|
};
|
|
160
227
|
|
|
161
228
|
export default function Translate<Str extends string>(
|
|
@@ -165,15 +232,23 @@ declare module '@docusaurus/Translate' {
|
|
|
165
232
|
|
|
166
233
|
declare module '@docusaurus/router' {
|
|
167
234
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
168
|
-
export
|
|
169
|
-
}
|
|
170
|
-
declare module '@docusaurus/history' {
|
|
171
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
172
|
-
export * from 'history';
|
|
235
|
+
export {useHistory, useLocation, Redirect, matchPath} from 'react-router-dom';
|
|
173
236
|
}
|
|
174
237
|
|
|
175
238
|
declare module '@docusaurus/useDocusaurusContext' {
|
|
176
|
-
|
|
239
|
+
import type {DocusaurusContext} from '@docusaurus/types';
|
|
240
|
+
|
|
241
|
+
export default function useDocusaurusContext(): DocusaurusContext;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
declare module '@docusaurus/useRouteContext' {
|
|
245
|
+
import type {PluginRouteContext} from '@docusaurus/types';
|
|
246
|
+
|
|
247
|
+
export default function useRouteContext(): PluginRouteContext;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
declare module '@docusaurus/useIsBrowser' {
|
|
251
|
+
export default function useIsBrowser(): boolean;
|
|
177
252
|
}
|
|
178
253
|
|
|
179
254
|
declare module '@docusaurus/useBaseUrl' {
|
|
@@ -207,20 +282,18 @@ declare module '@docusaurus/ExecutionEnvironment' {
|
|
|
207
282
|
declare module '@docusaurus/ComponentCreator' {
|
|
208
283
|
import type Loadable from 'react-loadable';
|
|
209
284
|
|
|
210
|
-
function ComponentCreator(
|
|
285
|
+
export default function ComponentCreator(
|
|
211
286
|
path: string,
|
|
212
287
|
hash: string,
|
|
213
288
|
): ReturnType<typeof Loadable>;
|
|
214
|
-
export default ComponentCreator;
|
|
215
289
|
}
|
|
216
290
|
|
|
217
291
|
declare module '@docusaurus/BrowserOnly' {
|
|
218
|
-
export
|
|
219
|
-
children?: () => JSX.Element;
|
|
220
|
-
fallback?: JSX.Element;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export default BrowserOnly;
|
|
292
|
+
export interface Props {
|
|
293
|
+
readonly children?: () => JSX.Element;
|
|
294
|
+
readonly fallback?: JSX.Element;
|
|
295
|
+
}
|
|
296
|
+
export default function BrowserOnly(props: Props): JSX.Element | null;
|
|
224
297
|
}
|
|
225
298
|
|
|
226
299
|
declare module '@docusaurus/isInternalUrl' {
|
|
@@ -240,17 +313,28 @@ declare module '@docusaurus/renderRoutes' {
|
|
|
240
313
|
}
|
|
241
314
|
|
|
242
315
|
declare module '@docusaurus/useGlobalData' {
|
|
243
|
-
|
|
316
|
+
import type {GlobalData, UseDataOptions} from '@docusaurus/types';
|
|
317
|
+
|
|
318
|
+
export function useAllPluginInstancesData(
|
|
244
319
|
pluginName: string,
|
|
245
|
-
|
|
320
|
+
options?: UseDataOptions,
|
|
321
|
+
): GlobalData[string] | undefined;
|
|
246
322
|
|
|
247
|
-
export function usePluginData
|
|
323
|
+
export function usePluginData(
|
|
248
324
|
pluginName: string,
|
|
249
325
|
pluginId?: string,
|
|
250
|
-
|
|
326
|
+
options?: UseDataOptions,
|
|
327
|
+
): GlobalData[string][string] | undefined;
|
|
251
328
|
|
|
252
|
-
function useGlobalData():
|
|
253
|
-
|
|
329
|
+
export default function useGlobalData(): GlobalData;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
declare module '*.svg' {
|
|
333
|
+
import type {ComponentType, SVGProps} from 'react';
|
|
334
|
+
|
|
335
|
+
const ReactComponent: ComponentType<SVGProps<SVGSVGElement>>;
|
|
336
|
+
|
|
337
|
+
export default ReactComponent;
|
|
254
338
|
}
|
|
255
339
|
|
|
256
340
|
declare module '*.module.css' {
|
|
@@ -262,3 +346,10 @@ declare module '*.css' {
|
|
|
262
346
|
const src: string;
|
|
263
347
|
export default src;
|
|
264
348
|
}
|
|
349
|
+
|
|
350
|
+
interface Window {
|
|
351
|
+
docusaurus: {
|
|
352
|
+
prefetch: (url: string) => false | Promise<void[]>;
|
|
353
|
+
preload: (url: string) => false | Promise<void[]>;
|
|
354
|
+
};
|
|
355
|
+
}
|