@docusaurus/module-type-aliases 2.0.0-beta.15d451942 → 2.0.0-beta.16
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 +154 -66
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.16",
|
|
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.16",
|
|
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": "eb43c4d4f95a4fb97dc9bb9dc615413e0dc2e1e7"
|
|
23
27
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -6,45 +6,58 @@
|
|
|
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 {DocusaurusSiteMetadata} from '@docusaurus/types';
|
|
24
|
+
|
|
25
|
+
const siteMetadata: DocusaurusSiteMetadata;
|
|
26
|
+
export = siteMetadata;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
declare module '@generated/registry' {
|
|
24
30
|
const registry: {
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
32
|
readonly [key: string]: [() => Promise<any>, string, string];
|
|
26
33
|
};
|
|
27
34
|
export default registry;
|
|
28
35
|
}
|
|
29
36
|
|
|
30
37
|
declare module '@generated/routes' {
|
|
31
|
-
type
|
|
38
|
+
import type {RouteConfig} from 'react-router-config';
|
|
39
|
+
|
|
40
|
+
export type Route = {
|
|
32
41
|
readonly path: string;
|
|
33
|
-
readonly component:
|
|
42
|
+
readonly component: RouteConfig['component'];
|
|
34
43
|
readonly exact?: boolean;
|
|
44
|
+
readonly routes?: Route[];
|
|
35
45
|
};
|
|
36
46
|
const routes: Route[];
|
|
37
47
|
export default routes;
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
declare module '@generated/routesChunkNames' {
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
import type {RouteChunksTree} from '@docusaurus/types';
|
|
52
|
+
|
|
53
|
+
const routesChunkNames: Record<string, RouteChunksTree>;
|
|
54
|
+
export = routesChunkNames;
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
declare module '@generated/globalData' {
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
+
const globalData: Record<string, any>;
|
|
60
|
+
export = globalData;
|
|
48
61
|
}
|
|
49
62
|
|
|
50
63
|
declare module '@generated/i18n' {
|
|
@@ -52,72 +65,127 @@ declare module '@generated/i18n' {
|
|
|
52
65
|
defaultLocale: string;
|
|
53
66
|
locales: [string, ...string[]];
|
|
54
67
|
currentLocale: string;
|
|
55
|
-
localeConfigs: Record<
|
|
68
|
+
localeConfigs: Record<
|
|
69
|
+
string,
|
|
70
|
+
{
|
|
71
|
+
label: string;
|
|
72
|
+
direction: string;
|
|
73
|
+
htmlLang: string;
|
|
74
|
+
}
|
|
75
|
+
>;
|
|
56
76
|
};
|
|
57
|
-
export
|
|
77
|
+
export = i18n;
|
|
58
78
|
}
|
|
59
79
|
|
|
60
80
|
declare module '@generated/codeTranslations' {
|
|
61
81
|
const codeTranslations: Record<string, string>;
|
|
62
|
-
export
|
|
82
|
+
export = codeTranslations;
|
|
63
83
|
}
|
|
64
84
|
|
|
65
|
-
declare module '@theme/*';
|
|
66
|
-
|
|
67
85
|
declare module '@theme-original/*';
|
|
86
|
+
declare module '@theme-init/*';
|
|
87
|
+
|
|
88
|
+
declare module '@theme/Error' {
|
|
89
|
+
export interface Props {
|
|
90
|
+
readonly error: Error;
|
|
91
|
+
readonly tryAgain: () => void;
|
|
92
|
+
}
|
|
93
|
+
export default function Error(props: Props): JSX.Element;
|
|
94
|
+
}
|
|
68
95
|
|
|
69
|
-
declare module '@
|
|
96
|
+
declare module '@theme/Layout' {
|
|
97
|
+
import type {ReactNode} from 'react';
|
|
70
98
|
|
|
71
|
-
|
|
72
|
-
|
|
99
|
+
export interface Props {
|
|
100
|
+
readonly children?: ReactNode;
|
|
101
|
+
readonly title?: string;
|
|
102
|
+
readonly description?: string;
|
|
103
|
+
}
|
|
104
|
+
export default function Layout(props: Props): JSX.Element;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare module '@theme/Loading' {
|
|
108
|
+
import type {LoadingComponentProps} from 'react-loadable';
|
|
109
|
+
|
|
110
|
+
export default function Loading(props: LoadingComponentProps): JSX.Element;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
declare module '@theme/NotFound' {
|
|
114
|
+
export default function NotFound(): JSX.Element;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
declare module '@theme/Root' {
|
|
73
118
|
import type {ReactNode} from 'react';
|
|
74
119
|
|
|
75
|
-
export
|
|
120
|
+
export interface Props {
|
|
121
|
+
readonly children: ReactNode;
|
|
122
|
+
}
|
|
123
|
+
export default function Root({children}: Props): JSX.Element;
|
|
124
|
+
}
|
|
76
125
|
|
|
77
|
-
|
|
78
|
-
export default
|
|
126
|
+
declare module '@docusaurus/constants' {
|
|
127
|
+
export const DEFAULT_PLUGIN_ID: 'default';
|
|
79
128
|
}
|
|
80
129
|
|
|
81
|
-
declare module '@docusaurus/
|
|
130
|
+
declare module '@docusaurus/ErrorBoundary' {
|
|
82
131
|
import type {ReactNode} from 'react';
|
|
132
|
+
import type ErrorComponent from '@theme/Error';
|
|
83
133
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
readonly
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
readonly children?: ReactNode;
|
|
91
|
-
readonly isActive?: (match: any, location: any) => boolean;
|
|
92
|
-
readonly autoAddBaseUrl?: boolean;
|
|
134
|
+
export interface Props {
|
|
135
|
+
readonly fallback?: typeof ErrorComponent;
|
|
136
|
+
readonly children: ReactNode;
|
|
137
|
+
}
|
|
138
|
+
export default function ErrorBoundary(props: Props): JSX.Element;
|
|
139
|
+
}
|
|
93
140
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export
|
|
141
|
+
declare module '@docusaurus/Head' {
|
|
142
|
+
import type {HelmetProps} from 'react-helmet-async';
|
|
143
|
+
import type {ReactNode} from 'react';
|
|
144
|
+
|
|
145
|
+
export type Props = HelmetProps & {children: ReactNode};
|
|
146
|
+
|
|
147
|
+
export default function Head(props: Props): JSX.Element;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare module '@docusaurus/Link' {
|
|
151
|
+
import type {CSSProperties, ComponentProps} from 'react';
|
|
152
|
+
|
|
153
|
+
type NavLinkProps = Partial<import('react-router-dom').NavLinkProps>;
|
|
154
|
+
export type Props = NavLinkProps &
|
|
155
|
+
ComponentProps<'a'> & {
|
|
156
|
+
readonly className?: string;
|
|
157
|
+
readonly style?: CSSProperties;
|
|
158
|
+
readonly isNavLink?: boolean;
|
|
159
|
+
readonly to?: string;
|
|
160
|
+
readonly href?: string;
|
|
161
|
+
readonly autoAddBaseUrl?: boolean;
|
|
162
|
+
|
|
163
|
+
// escape hatch in case broken links check is annoying for a specific link
|
|
164
|
+
readonly 'data-noBrokenLinkCheck'?: boolean;
|
|
165
|
+
};
|
|
166
|
+
export default function Link(props: Props): JSX.Element;
|
|
99
167
|
}
|
|
100
168
|
|
|
101
169
|
declare module '@docusaurus/Interpolate' {
|
|
102
170
|
import type {ReactNode} from 'react';
|
|
103
171
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
172
|
+
export type ExtractInterpolatePlaceholders<Str extends string> =
|
|
173
|
+
Str extends `${string}{${infer Key}}${infer Rest}`
|
|
174
|
+
? Key | ExtractInterpolatePlaceholders<Rest>
|
|
175
|
+
: never;
|
|
108
176
|
|
|
109
177
|
export type InterpolateValues<
|
|
110
178
|
Str extends string,
|
|
111
|
-
Value extends ReactNode
|
|
179
|
+
Value extends ReactNode,
|
|
112
180
|
> = Record<ExtractInterpolatePlaceholders<Str>, Value>;
|
|
113
181
|
|
|
114
|
-
//
|
|
182
|
+
// If all the values are plain strings, interpolate returns a simple string
|
|
115
183
|
export function interpolate<Str extends string>(
|
|
116
184
|
text: Str,
|
|
117
185
|
values?: InterpolateValues<Str, string | number>,
|
|
118
186
|
): string;
|
|
119
187
|
|
|
120
|
-
// If values contain any ReactNode,
|
|
188
|
+
// If values contain any ReactNode, the return is a ReactNode
|
|
121
189
|
export function interpolate<Str extends string, Value extends ReactNode>(
|
|
122
190
|
text: Str,
|
|
123
191
|
values?: InterpolateValues<Str, Value>,
|
|
@@ -134,18 +202,23 @@ declare module '@docusaurus/Interpolate' {
|
|
|
134
202
|
}
|
|
135
203
|
|
|
136
204
|
declare module '@docusaurus/Translate' {
|
|
137
|
-
import type {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
205
|
+
import type {ReactNode} from 'react';
|
|
206
|
+
import type {InterpolateValues} from '@docusaurus/Interpolate';
|
|
207
|
+
|
|
208
|
+
// TS type to ensure that at least one of id or message is always provided
|
|
209
|
+
// (Generic permits to handled message provided as React children)
|
|
210
|
+
type IdOrMessage<
|
|
211
|
+
MessageKey extends 'children' | 'message',
|
|
212
|
+
Str extends string,
|
|
213
|
+
> =
|
|
214
|
+
| ({[key in MessageKey]: Str} & {id?: string})
|
|
215
|
+
| ({[key in MessageKey]?: Str} & {id: string});
|
|
141
216
|
|
|
142
|
-
export type TranslateParam<Str extends string> =
|
|
143
|
-
|
|
217
|
+
export type TranslateParam<Str extends string> = IdOrMessage<
|
|
218
|
+
'message',
|
|
219
|
+
Str
|
|
144
220
|
> & {
|
|
145
|
-
message: Str;
|
|
146
|
-
id?: string;
|
|
147
221
|
description?: string;
|
|
148
|
-
values?: InterpolateValues<Str, string | number>;
|
|
149
222
|
};
|
|
150
223
|
|
|
151
224
|
export function translate<Str extends string>(
|
|
@@ -153,9 +226,12 @@ declare module '@docusaurus/Translate' {
|
|
|
153
226
|
values?: InterpolateValues<Str, string | number>,
|
|
154
227
|
): string;
|
|
155
228
|
|
|
156
|
-
export type TranslateProps<Str extends string> =
|
|
157
|
-
|
|
229
|
+
export type TranslateProps<Str extends string> = IdOrMessage<
|
|
230
|
+
'children',
|
|
231
|
+
Str
|
|
232
|
+
> & {
|
|
158
233
|
description?: string;
|
|
234
|
+
values?: InterpolateValues<Str, ReactNode>;
|
|
159
235
|
};
|
|
160
236
|
|
|
161
237
|
export default function Translate<Str extends string>(
|
|
@@ -165,11 +241,17 @@ declare module '@docusaurus/Translate' {
|
|
|
165
241
|
|
|
166
242
|
declare module '@docusaurus/router' {
|
|
167
243
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
168
|
-
export
|
|
244
|
+
export {useHistory, useLocation, Redirect, matchPath} from 'react-router-dom';
|
|
169
245
|
}
|
|
170
246
|
|
|
171
247
|
declare module '@docusaurus/useDocusaurusContext' {
|
|
172
|
-
|
|
248
|
+
import type {DocusaurusContext} from '@docusaurus/types';
|
|
249
|
+
|
|
250
|
+
export default function useDocusaurusContext(): DocusaurusContext;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
declare module '@docusaurus/useIsBrowser' {
|
|
254
|
+
export default function useIsBrowser(): boolean;
|
|
173
255
|
}
|
|
174
256
|
|
|
175
257
|
declare module '@docusaurus/useBaseUrl' {
|
|
@@ -203,20 +285,18 @@ declare module '@docusaurus/ExecutionEnvironment' {
|
|
|
203
285
|
declare module '@docusaurus/ComponentCreator' {
|
|
204
286
|
import type Loadable from 'react-loadable';
|
|
205
287
|
|
|
206
|
-
function ComponentCreator(
|
|
288
|
+
export default function ComponentCreator(
|
|
207
289
|
path: string,
|
|
208
290
|
hash: string,
|
|
209
291
|
): ReturnType<typeof Loadable>;
|
|
210
|
-
export default ComponentCreator;
|
|
211
292
|
}
|
|
212
293
|
|
|
213
294
|
declare module '@docusaurus/BrowserOnly' {
|
|
214
|
-
export
|
|
215
|
-
children?: () => JSX.Element;
|
|
216
|
-
fallback?: JSX.Element;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export default BrowserOnly;
|
|
295
|
+
export interface Props {
|
|
296
|
+
readonly children?: () => JSX.Element;
|
|
297
|
+
readonly fallback?: JSX.Element;
|
|
298
|
+
}
|
|
299
|
+
export default function BrowserOnly(props: Props): JSX.Element | null;
|
|
220
300
|
}
|
|
221
301
|
|
|
222
302
|
declare module '@docusaurus/isInternalUrl' {
|
|
@@ -245,8 +325,16 @@ declare module '@docusaurus/useGlobalData' {
|
|
|
245
325
|
pluginId?: string,
|
|
246
326
|
): T;
|
|
247
327
|
|
|
248
|
-
|
|
249
|
-
export default useGlobalData
|
|
328
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
329
|
+
export default function useGlobalData(): Record<string, any>;
|
|
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;
|
|
250
338
|
}
|
|
251
339
|
|
|
252
340
|
declare module '*.module.css' {
|