@types/react 18.2.22 → 18.2.24
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.
- react/README.md +1 -1
- react/canary.d.ts +5 -5
- react/experimental.d.ts +6 -6
- react/global.d.ts +142 -142
- react/index.d.ts +403 -320
- react/jsx-dev-runtime.d.ts +1 -1
- react/jsx-runtime.d.ts +1 -1
- react/package.json +2 -2
- react/ts5.0/canary.d.ts +5 -5
- react/ts5.0/experimental.d.ts +6 -6
- react/ts5.0/global.d.ts +142 -142
- react/ts5.0/index.d.ts +404 -321
- react/ts5.0/jsx-dev-runtime.d.ts +1 -1
- react/ts5.0/jsx-runtime.d.ts +1 -1
react/index.d.ts
CHANGED
@@ -36,9 +36,9 @@
|
|
36
36
|
|
37
37
|
/// <reference path="global.d.ts" />
|
38
38
|
|
39
|
-
import * as CSS from
|
40
|
-
import * as PropTypes from
|
41
|
-
import { Interaction as SchedulerInteraction } from
|
39
|
+
import * as CSS from "csstype";
|
40
|
+
import * as PropTypes from "prop-types";
|
41
|
+
import { Interaction as SchedulerInteraction } from "scheduler/tracing";
|
42
42
|
|
43
43
|
type NativeAnimationEvent = AnimationEvent;
|
44
44
|
type NativeClipboardEvent = ClipboardEvent;
|
@@ -52,8 +52,8 @@ type NativePointerEvent = PointerEvent;
|
|
52
52
|
type NativeTransitionEvent = TransitionEvent;
|
53
53
|
type NativeUIEvent = UIEvent;
|
54
54
|
type NativeWheelEvent = WheelEvent;
|
55
|
-
type Booleanish = boolean |
|
56
|
-
type CrossOrigin =
|
55
|
+
type Booleanish = boolean | "true" | "false";
|
56
|
+
type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined;
|
57
57
|
|
58
58
|
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
59
59
|
// Destructors are only allowed to return void.
|
@@ -70,27 +70,27 @@ declare namespace React {
|
|
70
70
|
// ----------------------------------------------------------------------
|
71
71
|
|
72
72
|
type ElementType<P = any> =
|
73
|
-
{
|
74
|
-
[K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never
|
75
|
-
}[keyof JSX.IntrinsicElements]
|
76
|
-
ComponentType<P>;
|
73
|
+
| {
|
74
|
+
[K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never;
|
75
|
+
}[keyof JSX.IntrinsicElements]
|
76
|
+
| ComponentType<P>;
|
77
77
|
type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
|
78
78
|
|
79
79
|
type JSXElementConstructor<P> =
|
80
80
|
| ((
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
| (new
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
81
|
+
props: P,
|
82
|
+
/**
|
83
|
+
* @deprecated https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-stateless-function-components
|
84
|
+
*/
|
85
|
+
deprecatedLegacyContext?: any,
|
86
|
+
) => ReactNode)
|
87
|
+
| (new(
|
88
|
+
props: P,
|
89
|
+
/**
|
90
|
+
* @deprecated https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods
|
91
|
+
*/
|
92
|
+
deprecatedLegacyContext?: any,
|
93
|
+
) => Component<any, any>);
|
94
94
|
|
95
95
|
interface RefObject<T> {
|
96
96
|
readonly current: T | null;
|
@@ -119,18 +119,16 @@ declare namespace React {
|
|
119
119
|
type ElementRef<
|
120
120
|
C extends
|
121
121
|
| ForwardRefExoticComponent<any>
|
122
|
-
| { new
|
122
|
+
| { new(props: any): Component<any> }
|
123
123
|
| ((props: any, context?: any) => ReactNode)
|
124
|
-
| keyof JSX.IntrinsicElements
|
124
|
+
| keyof JSX.IntrinsicElements,
|
125
125
|
> =
|
126
126
|
// need to check first if `ref` is a valid prop for ts@3.0
|
127
127
|
// otherwise it will infer `{}` instead of `never`
|
128
|
-
"ref" extends keyof ComponentPropsWithRef<C>
|
129
|
-
? NonNullable<ComponentPropsWithRef<C>["ref"]> extends Ref<
|
128
|
+
"ref" extends keyof ComponentPropsWithRef<C> ? NonNullable<ComponentPropsWithRef<C>["ref"]> extends Ref<
|
130
129
|
infer Instance
|
131
|
-
>
|
132
|
-
|
133
|
-
: never
|
130
|
+
> ? Instance
|
131
|
+
: never
|
134
132
|
: never;
|
135
133
|
|
136
134
|
type ComponentState = any;
|
@@ -161,19 +159,22 @@ declare namespace React {
|
|
161
159
|
ref?: LegacyRef<T> | undefined;
|
162
160
|
}
|
163
161
|
|
164
|
-
interface ReactElement<
|
162
|
+
interface ReactElement<
|
163
|
+
P = any,
|
164
|
+
T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>,
|
165
|
+
> {
|
165
166
|
type: T;
|
166
167
|
props: P;
|
167
|
-
key:
|
168
|
+
key: string | null;
|
168
169
|
}
|
169
170
|
|
170
171
|
interface ReactComponentElement<
|
171
172
|
T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>,
|
172
|
-
P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>,
|
173
|
-
> extends ReactElement<P, Exclude<T, number>> {
|
173
|
+
P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, "key" | "ref">>,
|
174
|
+
> extends ReactElement<P, Exclude<T, number>> {}
|
174
175
|
|
175
176
|
interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
|
176
|
-
ref?: (
|
177
|
+
ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
|
177
178
|
}
|
178
179
|
|
179
180
|
type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>;
|
@@ -184,12 +185,14 @@ declare namespace React {
|
|
184
185
|
type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
|
185
186
|
|
186
187
|
// string fallback for custom web-components
|
187
|
-
interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element>
|
188
|
+
interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element>
|
189
|
+
extends ReactElement<P, string>
|
190
|
+
{
|
188
191
|
ref: LegacyRef<T>;
|
189
192
|
}
|
190
193
|
|
191
194
|
// ReactHTML for ReactHTMLElement
|
192
|
-
interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {
|
195
|
+
interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {}
|
193
196
|
|
194
197
|
interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> {
|
195
198
|
type: keyof ReactHTML;
|
@@ -201,7 +204,6 @@ declare namespace React {
|
|
201
204
|
}
|
202
205
|
|
203
206
|
interface ReactPortal extends ReactElement {
|
204
|
-
key: Key | null;
|
205
207
|
children: ReactNode;
|
206
208
|
}
|
207
209
|
|
@@ -216,16 +218,23 @@ declare namespace React {
|
|
216
218
|
*/
|
217
219
|
type SFCFactory<P> = FunctionComponentFactory<P>;
|
218
220
|
|
219
|
-
type FunctionComponentFactory<P> = (
|
221
|
+
type FunctionComponentFactory<P> = (
|
222
|
+
props?: Attributes & P,
|
223
|
+
...children: ReactNode[]
|
224
|
+
) => FunctionComponentElement<P>;
|
220
225
|
|
221
|
-
type ComponentFactory<P, T extends Component<P, ComponentState>> =
|
222
|
-
|
226
|
+
type ComponentFactory<P, T extends Component<P, ComponentState>> = (
|
227
|
+
props?: ClassAttributes<T> & P,
|
228
|
+
...children: ReactNode[]
|
229
|
+
) => CElement<P, T>;
|
223
230
|
|
224
231
|
type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>;
|
225
232
|
type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>;
|
226
233
|
|
227
|
-
type DOMFactory<P extends DOMAttributes<T>, T extends Element> =
|
228
|
-
|
234
|
+
type DOMFactory<P extends DOMAttributes<T>, T extends Element> = (
|
235
|
+
props?: ClassAttributes<T> & P | null,
|
236
|
+
...children: ReactNode[]
|
237
|
+
) => DOMElement<P, T>;
|
229
238
|
|
230
239
|
interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {}
|
231
240
|
|
@@ -234,7 +243,10 @@ declare namespace React {
|
|
234
243
|
}
|
235
244
|
|
236
245
|
interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> {
|
237
|
-
(
|
246
|
+
(
|
247
|
+
props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null,
|
248
|
+
...children: ReactNode[]
|
249
|
+
): ReactSVGElement;
|
238
250
|
}
|
239
251
|
|
240
252
|
/**
|
@@ -270,7 +282,9 @@ declare namespace React {
|
|
270
282
|
| boolean
|
271
283
|
| null
|
272
284
|
| undefined
|
273
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
|
285
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
|
286
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES
|
287
|
+
];
|
274
288
|
|
275
289
|
//
|
276
290
|
// Top Level API
|
@@ -278,18 +292,23 @@ declare namespace React {
|
|
278
292
|
|
279
293
|
// DOM Elements
|
280
294
|
function createFactory<T extends HTMLElement>(
|
281
|
-
type: keyof ReactHTML
|
295
|
+
type: keyof ReactHTML,
|
296
|
+
): HTMLFactory<T>;
|
282
297
|
function createFactory(
|
283
|
-
type: keyof ReactSVG
|
298
|
+
type: keyof ReactSVG,
|
299
|
+
): SVGFactory;
|
284
300
|
function createFactory<P extends DOMAttributes<T>, T extends Element>(
|
285
|
-
type: string
|
301
|
+
type: string,
|
302
|
+
): DOMFactory<P, T>;
|
286
303
|
|
287
304
|
// Custom components
|
288
305
|
function createFactory<P>(type: FunctionComponent<P>): FunctionComponentFactory<P>;
|
289
306
|
function createFactory<P>(
|
290
|
-
type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P
|
307
|
+
type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
|
308
|
+
): CFactory<P, ClassicComponent<P, ComponentState>>;
|
291
309
|
function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
|
292
|
-
type: ClassType<P, T, C
|
310
|
+
type: ClassType<P, T, C>,
|
311
|
+
): CFactory<P, T>;
|
293
312
|
function createFactory<P>(type: ComponentClass<P>): Factory<P>;
|
294
313
|
|
295
314
|
// DOM Elements
|
@@ -297,74 +316,89 @@ declare namespace React {
|
|
297
316
|
function createElement(
|
298
317
|
type: "input",
|
299
318
|
props?: InputHTMLAttributes<HTMLInputElement> & ClassAttributes<HTMLInputElement> | null,
|
300
|
-
...children: ReactNode[]
|
319
|
+
...children: ReactNode[]
|
320
|
+
): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
301
321
|
function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
|
302
322
|
type: keyof ReactHTML,
|
303
323
|
props?: ClassAttributes<T> & P | null,
|
304
|
-
...children: ReactNode[]
|
324
|
+
...children: ReactNode[]
|
325
|
+
): DetailedReactHTMLElement<P, T>;
|
305
326
|
function createElement<P extends SVGAttributes<T>, T extends SVGElement>(
|
306
327
|
type: keyof ReactSVG,
|
307
328
|
props?: ClassAttributes<T> & P | null,
|
308
|
-
...children: ReactNode[]
|
329
|
+
...children: ReactNode[]
|
330
|
+
): ReactSVGElement;
|
309
331
|
function createElement<P extends DOMAttributes<T>, T extends Element>(
|
310
332
|
type: string,
|
311
333
|
props?: ClassAttributes<T> & P | null,
|
312
|
-
...children: ReactNode[]
|
334
|
+
...children: ReactNode[]
|
335
|
+
): DOMElement<P, T>;
|
313
336
|
|
314
337
|
// Custom components
|
315
338
|
|
316
339
|
function createElement<P extends {}>(
|
317
340
|
type: FunctionComponent<P>,
|
318
341
|
props?: Attributes & P | null,
|
319
|
-
...children: ReactNode[]
|
342
|
+
...children: ReactNode[]
|
343
|
+
): FunctionComponentElement<P>;
|
320
344
|
function createElement<P extends {}>(
|
321
345
|
type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
|
322
346
|
props?: ClassAttributes<ClassicComponent<P, ComponentState>> & P | null,
|
323
|
-
...children: ReactNode[]
|
347
|
+
...children: ReactNode[]
|
348
|
+
): CElement<P, ClassicComponent<P, ComponentState>>;
|
324
349
|
function createElement<P extends {}, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
|
325
350
|
type: ClassType<P, T, C>,
|
326
351
|
props?: ClassAttributes<T> & P | null,
|
327
|
-
...children: ReactNode[]
|
352
|
+
...children: ReactNode[]
|
353
|
+
): CElement<P, T>;
|
328
354
|
function createElement<P extends {}>(
|
329
355
|
type: FunctionComponent<P> | ComponentClass<P> | string,
|
330
356
|
props?: Attributes & P | null,
|
331
|
-
...children: ReactNode[]
|
357
|
+
...children: ReactNode[]
|
358
|
+
): ReactElement<P>;
|
332
359
|
|
333
360
|
// DOM Elements
|
334
361
|
// ReactHTMLElement
|
335
362
|
function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
|
336
363
|
element: DetailedReactHTMLElement<P, T>,
|
337
364
|
props?: P,
|
338
|
-
...children: ReactNode[]
|
365
|
+
...children: ReactNode[]
|
366
|
+
): DetailedReactHTMLElement<P, T>;
|
339
367
|
// ReactHTMLElement, less specific
|
340
368
|
function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
|
341
369
|
element: ReactHTMLElement<T>,
|
342
370
|
props?: P,
|
343
|
-
...children: ReactNode[]
|
371
|
+
...children: ReactNode[]
|
372
|
+
): ReactHTMLElement<T>;
|
344
373
|
// SVGElement
|
345
374
|
function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>(
|
346
375
|
element: ReactSVGElement,
|
347
376
|
props?: P,
|
348
|
-
...children: ReactNode[]
|
377
|
+
...children: ReactNode[]
|
378
|
+
): ReactSVGElement;
|
349
379
|
// DOM Element (has to be the last, because type checking stops at first overload that fits)
|
350
380
|
function cloneElement<P extends DOMAttributes<T>, T extends Element>(
|
351
381
|
element: DOMElement<P, T>,
|
352
382
|
props?: DOMAttributes<T> & P,
|
353
|
-
...children: ReactNode[]
|
383
|
+
...children: ReactNode[]
|
384
|
+
): DOMElement<P, T>;
|
354
385
|
|
355
386
|
// Custom components
|
356
387
|
function cloneElement<P>(
|
357
388
|
element: FunctionComponentElement<P>,
|
358
389
|
props?: Partial<P> & Attributes,
|
359
|
-
...children: ReactNode[]
|
390
|
+
...children: ReactNode[]
|
391
|
+
): FunctionComponentElement<P>;
|
360
392
|
function cloneElement<P, T extends Component<P, ComponentState>>(
|
361
393
|
element: CElement<P, T>,
|
362
394
|
props?: Partial<P> & ClassAttributes<T>,
|
363
|
-
...children: ReactNode[]
|
395
|
+
...children: ReactNode[]
|
396
|
+
): CElement<P, T>;
|
364
397
|
function cloneElement<P>(
|
365
398
|
element: ReactElement<P>,
|
366
399
|
props?: Partial<P> & Attributes,
|
367
|
-
...children: ReactNode[]
|
400
|
+
...children: ReactNode[]
|
401
|
+
): ReactElement<P>;
|
368
402
|
|
369
403
|
// Context via RenderProps
|
370
404
|
interface ProviderProps<T> {
|
@@ -423,8 +457,10 @@ declare namespace React {
|
|
423
457
|
|
424
458
|
// Sync with `ReactChildren` until `ReactChildren` is removed.
|
425
459
|
const Children: {
|
426
|
-
map<T, C>(
|
427
|
-
C
|
460
|
+
map<T, C>(
|
461
|
+
children: C | ReadonlyArray<C>,
|
462
|
+
fn: (child: C, index: number) => T,
|
463
|
+
): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
|
428
464
|
forEach<C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => void): void;
|
429
465
|
count(children: any): number;
|
430
466
|
only<C>(children: C): C extends any[] ? never : C;
|
@@ -470,7 +506,7 @@ declare namespace React {
|
|
470
506
|
type ReactInstance = Component<any> | Element;
|
471
507
|
|
472
508
|
// Base component for plain JS classes
|
473
|
-
interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {
|
509
|
+
interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {}
|
474
510
|
class Component<P, S> {
|
475
511
|
// tslint won't let me format the sample code in a way that vscode likes it :(
|
476
512
|
/**
|
@@ -523,8 +559,8 @@ declare namespace React {
|
|
523
559
|
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
|
524
560
|
// Also, the ` | S` allows intellisense to not be dumbisense
|
525
561
|
setState<K extends keyof S>(
|
526
|
-
state: ((prevState: Readonly<S>, props: Readonly<P>) =>
|
527
|
-
callback?: () => void
|
562
|
+
state: ((prevState: Readonly<S>, props: Readonly<P>) => Pick<S, K> | S | null) | (Pick<S, K> | S | null),
|
563
|
+
callback?: () => void,
|
528
564
|
): void;
|
529
565
|
|
530
566
|
forceUpdate(callback?: () => void): void;
|
@@ -537,11 +573,11 @@ declare namespace React {
|
|
537
573
|
* https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs
|
538
574
|
*/
|
539
575
|
refs: {
|
540
|
-
[key: string]: ReactInstance
|
576
|
+
[key: string]: ReactInstance;
|
541
577
|
};
|
542
578
|
}
|
543
579
|
|
544
|
-
class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {
|
580
|
+
class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {}
|
545
581
|
|
546
582
|
interface ClassicComponent<P = {}, S = {}> extends Component<P, S> {
|
547
583
|
replaceState(nextState: S, callback?: () => void): void;
|
@@ -601,7 +637,7 @@ declare namespace React {
|
|
601
637
|
}
|
602
638
|
|
603
639
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
604
|
-
new
|
640
|
+
new(props: P, context?: any): Component<P, S>;
|
605
641
|
propTypes?: WeakValidationMap<P> | undefined;
|
606
642
|
contextType?: Context<any> | undefined;
|
607
643
|
contextTypes?: ValidationMap<any> | undefined;
|
@@ -611,7 +647,7 @@ declare namespace React {
|
|
611
647
|
}
|
612
648
|
|
613
649
|
interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
|
614
|
-
new
|
650
|
+
new(props: P, context?: any): ClassicComponent<P, ComponentState>;
|
615
651
|
getDefaultProps?(): P;
|
616
652
|
}
|
617
653
|
|
@@ -621,8 +657,8 @@ declare namespace React {
|
|
621
657
|
* See https://github.com/Microsoft/TypeScript/issues/7234 for more info.
|
622
658
|
*/
|
623
659
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
624
|
-
C
|
625
|
-
(new
|
660
|
+
& C
|
661
|
+
& (new(props: P, context?: any) => T);
|
626
662
|
|
627
663
|
//
|
628
664
|
// Component Specs and Lifecycle
|
@@ -820,23 +856,24 @@ declare namespace React {
|
|
820
856
|
propTypes?: WeakValidationMap<P> | undefined;
|
821
857
|
}
|
822
858
|
|
823
|
-
function forwardRef<T, P = {}>(
|
859
|
+
function forwardRef<T, P = {}>(
|
860
|
+
render: ForwardRefRenderFunction<T, P>,
|
861
|
+
): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
|
824
862
|
|
825
863
|
/** Ensures that the props do not include ref at all */
|
826
864
|
type PropsWithoutRef<P> =
|
827
865
|
// Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
|
828
866
|
// see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
|
829
867
|
// https://github.com/Microsoft/TypeScript/issues/28339
|
830
|
-
P extends any ? (
|
868
|
+
P extends any ? ("ref" extends keyof P ? Omit<P, "ref"> : P) : P;
|
831
869
|
/** Ensures that the props do not include string ref, which cannot be forwarded */
|
832
870
|
type PropsWithRef<P> =
|
833
871
|
// Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}.
|
834
|
-
|
872
|
+
"ref" extends keyof P
|
835
873
|
? P extends { ref?: infer R | undefined }
|
836
|
-
? string extends R
|
837
|
-
? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
|
838
|
-
: P
|
874
|
+
? string extends R ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
|
839
875
|
: P
|
876
|
+
: P
|
840
877
|
: P;
|
841
878
|
|
842
879
|
type PropsWithChildren<P = unknown> = P & { children?: ReactNode | undefined };
|
@@ -845,26 +882,20 @@ declare namespace React {
|
|
845
882
|
* NOTE: prefer ComponentPropsWithRef, if the ref is forwarded,
|
846
883
|
* or ComponentPropsWithoutRef when refs are not supported.
|
847
884
|
*/
|
848
|
-
type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> =
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
|
857
|
-
: PropsWithRef<ComponentProps<T>>;
|
858
|
-
type ComponentPropsWithoutRef<T extends ElementType> =
|
859
|
-
PropsWithoutRef<ComponentProps<T>>;
|
885
|
+
type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends
|
886
|
+
JSXElementConstructor<infer P> ? P
|
887
|
+
: T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T]
|
888
|
+
: {};
|
889
|
+
type ComponentPropsWithRef<T extends ElementType> = T extends (new(props: infer P) => Component<any, any>)
|
890
|
+
? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
|
891
|
+
: PropsWithRef<ComponentProps<T>>;
|
892
|
+
type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;
|
860
893
|
|
861
894
|
type ComponentRef<T extends ElementType> = T extends NamedExoticComponent<
|
862
895
|
ComponentPropsWithoutRef<T> & RefAttributes<infer Method>
|
863
|
-
>
|
864
|
-
? Method
|
865
|
-
:
|
866
|
-
? Method
|
867
|
-
: never;
|
896
|
+
> ? Method
|
897
|
+
: ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
|
898
|
+
: never;
|
868
899
|
|
869
900
|
// will show `Memo(${Component.displayName || Component.name})` in devtools by default,
|
870
901
|
// but can be given its own specific name
|
@@ -874,11 +905,11 @@ declare namespace React {
|
|
874
905
|
|
875
906
|
function memo<P extends object>(
|
876
907
|
Component: FunctionComponent<P>,
|
877
|
-
propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean
|
908
|
+
propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean,
|
878
909
|
): NamedExoticComponent<P>;
|
879
910
|
function memo<T extends ComponentType<any>>(
|
880
911
|
Component: T,
|
881
|
-
propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean
|
912
|
+
propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean,
|
882
913
|
): MemoExoticComponent<T>;
|
883
914
|
|
884
915
|
type LazyExoticComponent<T extends ComponentType<any>> = ExoticComponent<ComponentPropsWithRef<T>> & {
|
@@ -886,7 +917,7 @@ declare namespace React {
|
|
886
917
|
};
|
887
918
|
|
888
919
|
function lazy<T extends ComponentType<any>>(
|
889
|
-
factory: () => Promise<{ default: T }
|
920
|
+
factory: () => Promise<{ default: T }>,
|
890
921
|
): LazyExoticComponent<T>;
|
891
922
|
|
892
923
|
//
|
@@ -911,12 +942,12 @@ declare namespace React {
|
|
911
942
|
type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
|
912
943
|
type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never;
|
913
944
|
// The identity check is done with the SameValue algorithm (Object.is), which is stricter than ===
|
914
|
-
type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> =
|
915
|
-
|
945
|
+
type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> = R extends ReducerWithoutAction<infer S> ? S
|
946
|
+
: never;
|
916
947
|
type DependencyList = ReadonlyArray<unknown>;
|
917
948
|
|
918
949
|
// NOTE: callbacks are _only_ allowed to return either void, or a destructor.
|
919
|
-
type EffectCallback = () =>
|
950
|
+
type EffectCallback = () => void | Destructor;
|
920
951
|
|
921
952
|
interface MutableRefObject<T> {
|
922
953
|
current: T;
|
@@ -930,7 +961,7 @@ declare namespace React {
|
|
930
961
|
* @version 16.8.0
|
931
962
|
* @see https://react.dev/reference/react/useContext
|
932
963
|
*/
|
933
|
-
function useContext<T>(context: Context<T
|
964
|
+
function useContext<T>(context: Context<T> /*, (not public API) observedBits?: number|boolean */): T;
|
934
965
|
/**
|
935
966
|
* Returns a stateful value, and a function to update it.
|
936
967
|
*
|
@@ -960,7 +991,7 @@ declare namespace React {
|
|
960
991
|
function useReducer<R extends ReducerWithoutAction<any>, I>(
|
961
992
|
reducer: R,
|
962
993
|
initializerArg: I,
|
963
|
-
initializer: (arg: I) => ReducerStateWithoutAction<R
|
994
|
+
initializer: (arg: I) => ReducerStateWithoutAction<R>,
|
964
995
|
): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
|
965
996
|
/**
|
966
997
|
* An alternative to `useState`.
|
@@ -976,7 +1007,7 @@ declare namespace React {
|
|
976
1007
|
function useReducer<R extends ReducerWithoutAction<any>>(
|
977
1008
|
reducer: R,
|
978
1009
|
initializerArg: ReducerStateWithoutAction<R>,
|
979
|
-
initializer?: undefined
|
1010
|
+
initializer?: undefined,
|
980
1011
|
): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
|
981
1012
|
/**
|
982
1013
|
* An alternative to `useState`.
|
@@ -994,7 +1025,7 @@ declare namespace React {
|
|
994
1025
|
function useReducer<R extends Reducer<any, any>, I>(
|
995
1026
|
reducer: R,
|
996
1027
|
initializerArg: I & ReducerState<R>,
|
997
|
-
initializer: (arg: I & ReducerState<R>) => ReducerState<R
|
1028
|
+
initializer: (arg: I & ReducerState<R>) => ReducerState<R>,
|
998
1029
|
): [ReducerState<R>, Dispatch<ReducerAction<R>>];
|
999
1030
|
/**
|
1000
1031
|
* An alternative to `useState`.
|
@@ -1010,7 +1041,7 @@ declare namespace React {
|
|
1010
1041
|
function useReducer<R extends Reducer<any, any>, I>(
|
1011
1042
|
reducer: R,
|
1012
1043
|
initializerArg: I,
|
1013
|
-
initializer: (arg: I) => ReducerState<R
|
1044
|
+
initializer: (arg: I) => ReducerState<R>,
|
1014
1045
|
): [ReducerState<R>, Dispatch<ReducerAction<R>>];
|
1015
1046
|
/**
|
1016
1047
|
* An alternative to `useState`.
|
@@ -1035,7 +1066,7 @@ declare namespace React {
|
|
1035
1066
|
function useReducer<R extends Reducer<any, any>>(
|
1036
1067
|
reducer: R,
|
1037
1068
|
initialState: ReducerState<R>,
|
1038
|
-
initializer?: undefined
|
1069
|
+
initializer?: undefined,
|
1039
1070
|
): [ReducerState<R>, Dispatch<ReducerAction<R>>];
|
1040
1071
|
/**
|
1041
1072
|
* `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
|
@@ -1062,7 +1093,7 @@ declare namespace React {
|
|
1062
1093
|
* @version 16.8.0
|
1063
1094
|
* @see https://react.dev/reference/react/useRef
|
1064
1095
|
*/
|
1065
|
-
function useRef<T>(initialValue: T|null): RefObject<T>;
|
1096
|
+
function useRef<T>(initialValue: T | null): RefObject<T>;
|
1066
1097
|
// convenience overload for potentially undefined initialValue / call with 0 arguments
|
1067
1098
|
// has a default to stop it from defaulting to {} instead
|
1068
1099
|
/**
|
@@ -1110,7 +1141,7 @@ declare namespace React {
|
|
1110
1141
|
* @version 16.8.0
|
1111
1142
|
* @see https://react.dev/reference/react/useImperativeHandle
|
1112
1143
|
*/
|
1113
|
-
function useImperativeHandle<T, R extends T>(ref: Ref<T
|
1144
|
+
function useImperativeHandle<T, R extends T>(ref: Ref<T> | undefined, init: () => R, deps?: DependencyList): void;
|
1114
1145
|
// I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key
|
1115
1146
|
// useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y.
|
1116
1147
|
/**
|
@@ -1205,7 +1236,7 @@ declare namespace React {
|
|
1205
1236
|
*
|
1206
1237
|
* @see https://github.com/facebook/react/pull/21913
|
1207
1238
|
*/
|
1208
|
-
|
1239
|
+
export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1209
1240
|
|
1210
1241
|
/**
|
1211
1242
|
* @param subscribe
|
@@ -1272,7 +1303,7 @@ declare namespace React {
|
|
1272
1303
|
twist: number;
|
1273
1304
|
width: number;
|
1274
1305
|
height: number;
|
1275
|
-
pointerType:
|
1306
|
+
pointerType: "mouse" | "pen" | "touch";
|
1276
1307
|
isPrimary: boolean;
|
1277
1308
|
}
|
1278
1309
|
|
@@ -1292,7 +1323,21 @@ declare namespace React {
|
|
1292
1323
|
target: EventTarget & T;
|
1293
1324
|
}
|
1294
1325
|
|
1295
|
-
export type ModifierKey =
|
1326
|
+
export type ModifierKey =
|
1327
|
+
| "Alt"
|
1328
|
+
| "AltGraph"
|
1329
|
+
| "CapsLock"
|
1330
|
+
| "Control"
|
1331
|
+
| "Fn"
|
1332
|
+
| "FnLock"
|
1333
|
+
| "Hyper"
|
1334
|
+
| "Meta"
|
1335
|
+
| "NumLock"
|
1336
|
+
| "ScrollLock"
|
1337
|
+
| "Shift"
|
1338
|
+
| "Super"
|
1339
|
+
| "Symbol"
|
1340
|
+
| "SymbolLock";
|
1296
1341
|
|
1297
1342
|
interface KeyboardEvent<T = Element> extends UIEvent<T, NativeKeyboardEvent> {
|
1298
1343
|
altKey: boolean;
|
@@ -1634,287 +1679,298 @@ declare namespace React {
|
|
1634
1679
|
// All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/
|
1635
1680
|
interface AriaAttributes {
|
1636
1681
|
/** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */
|
1637
|
-
|
1682
|
+
"aria-activedescendant"?: string | undefined;
|
1638
1683
|
/** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */
|
1639
|
-
|
1684
|
+
"aria-atomic"?: Booleanish | undefined;
|
1640
1685
|
/**
|
1641
1686
|
* Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be
|
1642
1687
|
* presented if they are made.
|
1643
1688
|
*/
|
1644
|
-
|
1689
|
+
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
1645
1690
|
/** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */
|
1646
1691
|
/**
|
1647
1692
|
* Defines a string value that labels the current element, which is intended to be converted into Braille.
|
1648
1693
|
* @see aria-label.
|
1649
1694
|
*/
|
1650
|
-
|
1695
|
+
"aria-braillelabel"?: string | undefined;
|
1651
1696
|
/**
|
1652
1697
|
* Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.
|
1653
1698
|
* @see aria-roledescription.
|
1654
1699
|
*/
|
1655
|
-
|
1656
|
-
|
1700
|
+
"aria-brailleroledescription"?: string | undefined;
|
1701
|
+
"aria-busy"?: Booleanish | undefined;
|
1657
1702
|
/**
|
1658
1703
|
* Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
|
1659
1704
|
* @see aria-pressed @see aria-selected.
|
1660
1705
|
*/
|
1661
|
-
|
1706
|
+
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
|
1662
1707
|
/**
|
1663
1708
|
* Defines the total number of columns in a table, grid, or treegrid.
|
1664
1709
|
* @see aria-colindex.
|
1665
1710
|
*/
|
1666
|
-
|
1711
|
+
"aria-colcount"?: number | undefined;
|
1667
1712
|
/**
|
1668
1713
|
* Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
|
1669
1714
|
* @see aria-colcount @see aria-colspan.
|
1670
1715
|
*/
|
1671
|
-
|
1716
|
+
"aria-colindex"?: number | undefined;
|
1672
1717
|
/**
|
1673
1718
|
* Defines a human readable text alternative of aria-colindex.
|
1674
1719
|
* @see aria-rowindextext.
|
1675
1720
|
*/
|
1676
|
-
|
1721
|
+
"aria-colindextext"?: string | undefined;
|
1677
1722
|
/**
|
1678
1723
|
* Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
|
1679
1724
|
* @see aria-colindex @see aria-rowspan.
|
1680
1725
|
*/
|
1681
|
-
|
1726
|
+
"aria-colspan"?: number | undefined;
|
1682
1727
|
/**
|
1683
1728
|
* Identifies the element (or elements) whose contents or presence are controlled by the current element.
|
1684
1729
|
* @see aria-owns.
|
1685
1730
|
*/
|
1686
|
-
|
1731
|
+
"aria-controls"?: string | undefined;
|
1687
1732
|
/** Indicates the element that represents the current item within a container or set of related elements. */
|
1688
|
-
|
1733
|
+
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
|
1689
1734
|
/**
|
1690
1735
|
* Identifies the element (or elements) that describes the object.
|
1691
1736
|
* @see aria-labelledby
|
1692
1737
|
*/
|
1693
|
-
|
1738
|
+
"aria-describedby"?: string | undefined;
|
1694
1739
|
/**
|
1695
1740
|
* Defines a string value that describes or annotates the current element.
|
1696
1741
|
* @see related aria-describedby.
|
1697
1742
|
*/
|
1698
|
-
|
1743
|
+
"aria-description"?: string | undefined;
|
1699
1744
|
/**
|
1700
1745
|
* Identifies the element that provides a detailed, extended description for the object.
|
1701
1746
|
* @see aria-describedby.
|
1702
1747
|
*/
|
1703
|
-
|
1748
|
+
"aria-details"?: string | undefined;
|
1704
1749
|
/**
|
1705
1750
|
* Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
|
1706
1751
|
* @see aria-hidden @see aria-readonly.
|
1707
1752
|
*/
|
1708
|
-
|
1753
|
+
"aria-disabled"?: Booleanish | undefined;
|
1709
1754
|
/**
|
1710
1755
|
* Indicates what functions can be performed when a dragged object is released on the drop target.
|
1711
1756
|
* @deprecated in ARIA 1.1
|
1712
1757
|
*/
|
1713
|
-
|
1758
|
+
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
|
1714
1759
|
/**
|
1715
1760
|
* Identifies the element that provides an error message for the object.
|
1716
1761
|
* @see aria-invalid @see aria-describedby.
|
1717
1762
|
*/
|
1718
|
-
|
1763
|
+
"aria-errormessage"?: string | undefined;
|
1719
1764
|
/** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */
|
1720
|
-
|
1765
|
+
"aria-expanded"?: Booleanish | undefined;
|
1721
1766
|
/**
|
1722
1767
|
* Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,
|
1723
1768
|
* allows assistive technology to override the general default of reading in document source order.
|
1724
1769
|
*/
|
1725
|
-
|
1770
|
+
"aria-flowto"?: string | undefined;
|
1726
1771
|
/**
|
1727
1772
|
* Indicates an element's "grabbed" state in a drag-and-drop operation.
|
1728
1773
|
* @deprecated in ARIA 1.1
|
1729
1774
|
*/
|
1730
|
-
|
1775
|
+
"aria-grabbed"?: Booleanish | undefined;
|
1731
1776
|
/** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */
|
1732
|
-
|
1777
|
+
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
1733
1778
|
/**
|
1734
1779
|
* Indicates whether the element is exposed to an accessibility API.
|
1735
1780
|
* @see aria-disabled.
|
1736
1781
|
*/
|
1737
|
-
|
1782
|
+
"aria-hidden"?: Booleanish | undefined;
|
1738
1783
|
/**
|
1739
1784
|
* Indicates the entered value does not conform to the format expected by the application.
|
1740
1785
|
* @see aria-errormessage.
|
1741
1786
|
*/
|
1742
|
-
|
1787
|
+
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
1743
1788
|
/** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */
|
1744
|
-
|
1789
|
+
"aria-keyshortcuts"?: string | undefined;
|
1745
1790
|
/**
|
1746
1791
|
* Defines a string value that labels the current element.
|
1747
1792
|
* @see aria-labelledby.
|
1748
1793
|
*/
|
1749
|
-
|
1794
|
+
"aria-label"?: string | undefined;
|
1750
1795
|
/**
|
1751
1796
|
* Identifies the element (or elements) that labels the current element.
|
1752
1797
|
* @see aria-describedby.
|
1753
1798
|
*/
|
1754
|
-
|
1799
|
+
"aria-labelledby"?: string | undefined;
|
1755
1800
|
/** Defines the hierarchical level of an element within a structure. */
|
1756
|
-
|
1801
|
+
"aria-level"?: number | undefined;
|
1757
1802
|
/** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */
|
1758
|
-
|
1803
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
1759
1804
|
/** Indicates whether an element is modal when displayed. */
|
1760
|
-
|
1805
|
+
"aria-modal"?: Booleanish | undefined;
|
1761
1806
|
/** Indicates whether a text box accepts multiple lines of input or only a single line. */
|
1762
|
-
|
1807
|
+
"aria-multiline"?: Booleanish | undefined;
|
1763
1808
|
/** Indicates that the user may select more than one item from the current selectable descendants. */
|
1764
|
-
|
1809
|
+
"aria-multiselectable"?: Booleanish | undefined;
|
1765
1810
|
/** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */
|
1766
|
-
|
1811
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
1767
1812
|
/**
|
1768
1813
|
* Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship
|
1769
1814
|
* between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
|
1770
1815
|
* @see aria-controls.
|
1771
1816
|
*/
|
1772
|
-
|
1817
|
+
"aria-owns"?: string | undefined;
|
1773
1818
|
/**
|
1774
1819
|
* Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.
|
1775
1820
|
* A hint could be a sample value or a brief description of the expected format.
|
1776
1821
|
*/
|
1777
|
-
|
1822
|
+
"aria-placeholder"?: string | undefined;
|
1778
1823
|
/**
|
1779
1824
|
* Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
|
1780
1825
|
* @see aria-setsize.
|
1781
1826
|
*/
|
1782
|
-
|
1827
|
+
"aria-posinset"?: number | undefined;
|
1783
1828
|
/**
|
1784
1829
|
* Indicates the current "pressed" state of toggle buttons.
|
1785
1830
|
* @see aria-checked @see aria-selected.
|
1786
1831
|
*/
|
1787
|
-
|
1832
|
+
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
|
1788
1833
|
/**
|
1789
1834
|
* Indicates that the element is not editable, but is otherwise operable.
|
1790
1835
|
* @see aria-disabled.
|
1791
1836
|
*/
|
1792
|
-
|
1837
|
+
"aria-readonly"?: Booleanish | undefined;
|
1793
1838
|
/**
|
1794
1839
|
* Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
|
1795
1840
|
* @see aria-atomic.
|
1796
1841
|
*/
|
1797
|
-
|
1842
|
+
"aria-relevant"?:
|
1843
|
+
| "additions"
|
1844
|
+
| "additions removals"
|
1845
|
+
| "additions text"
|
1846
|
+
| "all"
|
1847
|
+
| "removals"
|
1848
|
+
| "removals additions"
|
1849
|
+
| "removals text"
|
1850
|
+
| "text"
|
1851
|
+
| "text additions"
|
1852
|
+
| "text removals"
|
1853
|
+
| undefined;
|
1798
1854
|
/** Indicates that user input is required on the element before a form may be submitted. */
|
1799
|
-
|
1855
|
+
"aria-required"?: Booleanish | undefined;
|
1800
1856
|
/** Defines a human-readable, author-localized description for the role of an element. */
|
1801
|
-
|
1857
|
+
"aria-roledescription"?: string | undefined;
|
1802
1858
|
/**
|
1803
1859
|
* Defines the total number of rows in a table, grid, or treegrid.
|
1804
1860
|
* @see aria-rowindex.
|
1805
1861
|
*/
|
1806
|
-
|
1862
|
+
"aria-rowcount"?: number | undefined;
|
1807
1863
|
/**
|
1808
1864
|
* Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
|
1809
1865
|
* @see aria-rowcount @see aria-rowspan.
|
1810
1866
|
*/
|
1811
|
-
|
1867
|
+
"aria-rowindex"?: number | undefined;
|
1812
1868
|
/**
|
1813
1869
|
* Defines a human readable text alternative of aria-rowindex.
|
1814
1870
|
* @see aria-colindextext.
|
1815
1871
|
*/
|
1816
|
-
|
1872
|
+
"aria-rowindextext"?: string | undefined;
|
1817
1873
|
/**
|
1818
1874
|
* Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
|
1819
1875
|
* @see aria-rowindex @see aria-colspan.
|
1820
1876
|
*/
|
1821
|
-
|
1877
|
+
"aria-rowspan"?: number | undefined;
|
1822
1878
|
/**
|
1823
1879
|
* Indicates the current "selected" state of various widgets.
|
1824
1880
|
* @see aria-checked @see aria-pressed.
|
1825
1881
|
*/
|
1826
|
-
|
1882
|
+
"aria-selected"?: Booleanish | undefined;
|
1827
1883
|
/**
|
1828
1884
|
* Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
|
1829
1885
|
* @see aria-posinset.
|
1830
1886
|
*/
|
1831
|
-
|
1887
|
+
"aria-setsize"?: number | undefined;
|
1832
1888
|
/** Indicates if items in a table or grid are sorted in ascending or descending order. */
|
1833
|
-
|
1889
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
1834
1890
|
/** Defines the maximum allowed value for a range widget. */
|
1835
|
-
|
1891
|
+
"aria-valuemax"?: number | undefined;
|
1836
1892
|
/** Defines the minimum allowed value for a range widget. */
|
1837
|
-
|
1893
|
+
"aria-valuemin"?: number | undefined;
|
1838
1894
|
/**
|
1839
1895
|
* Defines the current value for a range widget.
|
1840
1896
|
* @see aria-valuetext.
|
1841
1897
|
*/
|
1842
|
-
|
1898
|
+
"aria-valuenow"?: number | undefined;
|
1843
1899
|
/** Defines the human readable text alternative of aria-valuenow for a range widget. */
|
1844
|
-
|
1900
|
+
"aria-valuetext"?: string | undefined;
|
1845
1901
|
}
|
1846
1902
|
|
1847
1903
|
// All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions
|
1848
1904
|
type AriaRole =
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1905
|
+
| "alert"
|
1906
|
+
| "alertdialog"
|
1907
|
+
| "application"
|
1908
|
+
| "article"
|
1909
|
+
| "banner"
|
1910
|
+
| "button"
|
1911
|
+
| "cell"
|
1912
|
+
| "checkbox"
|
1913
|
+
| "columnheader"
|
1914
|
+
| "combobox"
|
1915
|
+
| "complementary"
|
1916
|
+
| "contentinfo"
|
1917
|
+
| "definition"
|
1918
|
+
| "dialog"
|
1919
|
+
| "directory"
|
1920
|
+
| "document"
|
1921
|
+
| "feed"
|
1922
|
+
| "figure"
|
1923
|
+
| "form"
|
1924
|
+
| "grid"
|
1925
|
+
| "gridcell"
|
1926
|
+
| "group"
|
1927
|
+
| "heading"
|
1928
|
+
| "img"
|
1929
|
+
| "link"
|
1930
|
+
| "list"
|
1931
|
+
| "listbox"
|
1932
|
+
| "listitem"
|
1933
|
+
| "log"
|
1934
|
+
| "main"
|
1935
|
+
| "marquee"
|
1936
|
+
| "math"
|
1937
|
+
| "menu"
|
1938
|
+
| "menubar"
|
1939
|
+
| "menuitem"
|
1940
|
+
| "menuitemcheckbox"
|
1941
|
+
| "menuitemradio"
|
1942
|
+
| "navigation"
|
1943
|
+
| "none"
|
1944
|
+
| "note"
|
1945
|
+
| "option"
|
1946
|
+
| "presentation"
|
1947
|
+
| "progressbar"
|
1948
|
+
| "radio"
|
1949
|
+
| "radiogroup"
|
1950
|
+
| "region"
|
1951
|
+
| "row"
|
1952
|
+
| "rowgroup"
|
1953
|
+
| "rowheader"
|
1954
|
+
| "scrollbar"
|
1955
|
+
| "search"
|
1956
|
+
| "searchbox"
|
1957
|
+
| "separator"
|
1958
|
+
| "slider"
|
1959
|
+
| "spinbutton"
|
1960
|
+
| "status"
|
1961
|
+
| "switch"
|
1962
|
+
| "tab"
|
1963
|
+
| "table"
|
1964
|
+
| "tablist"
|
1965
|
+
| "tabpanel"
|
1966
|
+
| "term"
|
1967
|
+
| "textbox"
|
1968
|
+
| "timer"
|
1969
|
+
| "toolbar"
|
1970
|
+
| "tooltip"
|
1971
|
+
| "tree"
|
1972
|
+
| "treegrid"
|
1973
|
+
| "treeitem"
|
1918
1974
|
| (string & {});
|
1919
1975
|
|
1920
1976
|
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
|
@@ -1942,7 +1998,7 @@ declare namespace React {
|
|
1942
1998
|
style?: CSSProperties | undefined;
|
1943
1999
|
tabIndex?: number | undefined;
|
1944
2000
|
title?: string | undefined;
|
1945
|
-
translate?:
|
2001
|
+
translate?: "yes" | "no" | undefined;
|
1946
2002
|
|
1947
2003
|
// Unknown
|
1948
2004
|
radioGroup?: string | undefined; // <command>, <menuitem>
|
@@ -1975,14 +2031,14 @@ declare namespace React {
|
|
1975
2031
|
itemRef?: string | undefined;
|
1976
2032
|
results?: number | undefined;
|
1977
2033
|
security?: string | undefined;
|
1978
|
-
unselectable?:
|
2034
|
+
unselectable?: "on" | "off" | undefined;
|
1979
2035
|
|
1980
2036
|
// Living Standard
|
1981
2037
|
/**
|
1982
2038
|
* Hints at the type of data that might be entered by the user while editing the element or its contents
|
1983
2039
|
* @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute
|
1984
2040
|
*/
|
1985
|
-
inputMode?:
|
2041
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
1986
2042
|
/**
|
1987
2043
|
* Specify that a standard HTML element should behave like a defined custom built-in element
|
1988
2044
|
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is
|
@@ -2004,7 +2060,9 @@ declare namespace React {
|
|
2004
2060
|
action?:
|
2005
2061
|
| string
|
2006
2062
|
| undefined
|
2007
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2063
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2064
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2065
|
+
];
|
2008
2066
|
allowFullScreen?: boolean | undefined;
|
2009
2067
|
allowTransparency?: boolean | undefined;
|
2010
2068
|
alt?: string | undefined;
|
@@ -2012,7 +2070,7 @@ declare namespace React {
|
|
2012
2070
|
async?: boolean | undefined;
|
2013
2071
|
autoComplete?: string | undefined;
|
2014
2072
|
autoPlay?: boolean | undefined;
|
2015
|
-
capture?: boolean |
|
2073
|
+
capture?: boolean | "user" | "environment" | undefined;
|
2016
2074
|
cellPadding?: number | string | undefined;
|
2017
2075
|
cellSpacing?: number | string | undefined;
|
2018
2076
|
charSet?: string | undefined;
|
@@ -2036,7 +2094,9 @@ declare namespace React {
|
|
2036
2094
|
formAction?:
|
2037
2095
|
| string
|
2038
2096
|
| undefined
|
2039
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2097
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2098
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2099
|
+
];
|
2040
2100
|
formEncType?: string | undefined;
|
2041
2101
|
formMethod?: string | undefined;
|
2042
2102
|
formNoValidate?: boolean | undefined;
|
@@ -2110,21 +2170,21 @@ declare namespace React {
|
|
2110
2170
|
}
|
2111
2171
|
|
2112
2172
|
type HTMLAttributeReferrerPolicy =
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2173
|
+
| ""
|
2174
|
+
| "no-referrer"
|
2175
|
+
| "no-referrer-when-downgrade"
|
2176
|
+
| "origin"
|
2177
|
+
| "origin-when-cross-origin"
|
2178
|
+
| "same-origin"
|
2179
|
+
| "strict-origin"
|
2180
|
+
| "strict-origin-when-cross-origin"
|
2181
|
+
| "unsafe-url";
|
2122
2182
|
|
2123
2183
|
type HTMLAttributeAnchorTarget =
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2184
|
+
| "_self"
|
2185
|
+
| "_blank"
|
2186
|
+
| "_parent"
|
2187
|
+
| "_top"
|
2128
2188
|
| (string & {});
|
2129
2189
|
|
2130
2190
|
interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
|
@@ -2166,14 +2226,16 @@ declare namespace React {
|
|
2166
2226
|
form?: string | undefined;
|
2167
2227
|
formAction?:
|
2168
2228
|
| string
|
2169
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2229
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2230
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2231
|
+
]
|
2170
2232
|
| undefined;
|
2171
2233
|
formEncType?: string | undefined;
|
2172
2234
|
formMethod?: string | undefined;
|
2173
2235
|
formNoValidate?: boolean | undefined;
|
2174
2236
|
formTarget?: string | undefined;
|
2175
2237
|
name?: string | undefined;
|
2176
|
-
type?:
|
2238
|
+
type?: "submit" | "reset" | "button" | undefined;
|
2177
2239
|
value?: string | ReadonlyArray<string> | number | undefined;
|
2178
2240
|
}
|
2179
2241
|
|
@@ -2206,8 +2268,8 @@ declare namespace React {
|
|
2206
2268
|
}
|
2207
2269
|
|
2208
2270
|
interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
|
2209
|
-
onCancel?: ReactEventHandler<T> |
|
2210
|
-
onClose?: ReactEventHandler<T> |
|
2271
|
+
onCancel?: ReactEventHandler<T> | undefined;
|
2272
|
+
onClose?: ReactEventHandler<T> | undefined;
|
2211
2273
|
open?: boolean | undefined;
|
2212
2274
|
}
|
2213
2275
|
|
@@ -2229,7 +2291,9 @@ declare namespace React {
|
|
2229
2291
|
action?:
|
2230
2292
|
| string
|
2231
2293
|
| undefined
|
2232
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2294
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2295
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2296
|
+
];
|
2233
2297
|
autoComplete?: string | undefined;
|
2234
2298
|
encType?: string | undefined;
|
2235
2299
|
method?: string | undefined;
|
@@ -2285,42 +2349,44 @@ declare namespace React {
|
|
2285
2349
|
}
|
2286
2350
|
|
2287
2351
|
type HTMLInputTypeAttribute =
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2352
|
+
| "button"
|
2353
|
+
| "checkbox"
|
2354
|
+
| "color"
|
2355
|
+
| "date"
|
2356
|
+
| "datetime-local"
|
2357
|
+
| "email"
|
2358
|
+
| "file"
|
2359
|
+
| "hidden"
|
2360
|
+
| "image"
|
2361
|
+
| "month"
|
2362
|
+
| "number"
|
2363
|
+
| "password"
|
2364
|
+
| "radio"
|
2365
|
+
| "range"
|
2366
|
+
| "reset"
|
2367
|
+
| "search"
|
2368
|
+
| "submit"
|
2369
|
+
| "tel"
|
2370
|
+
| "text"
|
2371
|
+
| "time"
|
2372
|
+
| "url"
|
2373
|
+
| "week"
|
2310
2374
|
| (string & {});
|
2311
2375
|
|
2312
2376
|
interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
|
2313
2377
|
accept?: string | undefined;
|
2314
2378
|
alt?: string | undefined;
|
2315
2379
|
autoComplete?: string | undefined;
|
2316
|
-
capture?: boolean |
|
2380
|
+
capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
|
2317
2381
|
checked?: boolean | undefined;
|
2318
2382
|
disabled?: boolean | undefined;
|
2319
|
-
enterKeyHint?:
|
2383
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
2320
2384
|
form?: string | undefined;
|
2321
2385
|
formAction?:
|
2322
2386
|
| string
|
2323
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2387
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2388
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2389
|
+
]
|
2324
2390
|
| undefined;
|
2325
2391
|
formEncType?: string | undefined;
|
2326
2392
|
formMethod?: string | undefined;
|
@@ -2440,7 +2506,7 @@ declare namespace React {
|
|
2440
2506
|
interface OlHTMLAttributes<T> extends HTMLAttributes<T> {
|
2441
2507
|
reversed?: boolean | undefined;
|
2442
2508
|
start?: number | undefined;
|
2443
|
-
type?:
|
2509
|
+
type?: "1" | "a" | "A" | "i" | "I" | undefined;
|
2444
2510
|
}
|
2445
2511
|
|
2446
2512
|
interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> {
|
@@ -2627,8 +2693,21 @@ declare namespace React {
|
|
2627
2693
|
accentHeight?: number | string | undefined;
|
2628
2694
|
accumulate?: "none" | "sum" | undefined;
|
2629
2695
|
additive?: "replace" | "sum" | undefined;
|
2630
|
-
alignmentBaseline?:
|
2631
|
-
|
2696
|
+
alignmentBaseline?:
|
2697
|
+
| "auto"
|
2698
|
+
| "baseline"
|
2699
|
+
| "before-edge"
|
2700
|
+
| "text-before-edge"
|
2701
|
+
| "middle"
|
2702
|
+
| "central"
|
2703
|
+
| "after-edge"
|
2704
|
+
| "text-after-edge"
|
2705
|
+
| "ideographic"
|
2706
|
+
| "alphabetic"
|
2707
|
+
| "hanging"
|
2708
|
+
| "mathematical"
|
2709
|
+
| "inherit"
|
2710
|
+
| undefined;
|
2632
2711
|
allowReorder?: "no" | "yes" | undefined;
|
2633
2712
|
alphabetic?: number | string | undefined;
|
2634
2713
|
amplitude?: number | string | undefined;
|
@@ -3071,7 +3150,7 @@ declare namespace React {
|
|
3071
3150
|
view: SVGFactory;
|
3072
3151
|
}
|
3073
3152
|
|
3074
|
-
interface ReactDOM extends ReactHTML, ReactSVG {
|
3153
|
+
interface ReactDOM extends ReactHTML, ReactSVG {}
|
3075
3154
|
|
3076
3155
|
//
|
3077
3156
|
// React.PropTypes
|
@@ -3084,11 +3163,9 @@ declare namespace React {
|
|
3084
3163
|
type ValidationMap<T> = PropTypes.ValidationMap<T>;
|
3085
3164
|
|
3086
3165
|
type WeakValidationMap<T> = {
|
3087
|
-
[K in keyof T]?: null extends T[K]
|
3088
|
-
? Validator<T[K] | null | undefined>
|
3089
|
-
:
|
3090
|
-
? Validator<T[K] | null | undefined>
|
3091
|
-
: Validator<T[K]>
|
3166
|
+
[K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined>
|
3167
|
+
: undefined extends T[K] ? Validator<T[K] | null | undefined>
|
3168
|
+
: Validator<T[K]>;
|
3092
3169
|
};
|
3093
3170
|
|
3094
3171
|
interface ReactPropTypes {
|
@@ -3119,8 +3196,10 @@ declare namespace React {
|
|
3119
3196
|
*/
|
3120
3197
|
// Sync with type of `const Children`.
|
3121
3198
|
interface ReactChildren {
|
3122
|
-
map<T, C>(
|
3123
|
-
C
|
3199
|
+
map<T, C>(
|
3200
|
+
children: C | ReadonlyArray<C>,
|
3201
|
+
fn: (child: C, index: number) => T,
|
3202
|
+
): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
|
3124
3203
|
forEach<C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => void): void;
|
3125
3204
|
count(children: any): number;
|
3126
3205
|
only<C>(children: C): C extends any[] ? never : C;
|
@@ -3193,15 +3272,16 @@ type MergePropTypes<P, T> =
|
|
3193
3272
|
// Distribute over P in case it is a union type
|
3194
3273
|
P extends any
|
3195
3274
|
// If props is type any, use propTypes definitions
|
3196
|
-
? IsExactlyAny<P> extends true ? T
|
3275
|
+
? IsExactlyAny<P> extends true ? T
|
3197
3276
|
// If declared props have indexed properties, ignore inferred props entirely as keyof gets widened
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3277
|
+
: string extends keyof P ? P
|
3278
|
+
// Prefer declared types which are not exactly any
|
3279
|
+
:
|
3280
|
+
& Pick<P, NotExactlyAnyPropertyKeys<P>>
|
3281
|
+
// For props which are exactly any, use the type inferred from propTypes if present
|
3282
|
+
& Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>>
|
3283
|
+
// Keep leftover props not specified in propTypes
|
3284
|
+
& Pick<P, Exclude<keyof P, keyof T>>
|
3205
3285
|
: never;
|
3206
3286
|
|
3207
3287
|
type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
|
@@ -3210,20 +3290,18 @@ type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
|
|
3210
3290
|
// Undeclared default props are augmented into the resulting allowable attributes
|
3211
3291
|
// If declared props have indexed properties, ignore default props entirely as keyof gets widened
|
3212
3292
|
// Wrap in an outer-level conditional type to allow distribution over props that are unions
|
3213
|
-
type Defaultize<P, D> = P extends any
|
3214
|
-
|
3293
|
+
type Defaultize<P, D> = P extends any ? string extends keyof P ? P
|
3294
|
+
:
|
3215
3295
|
& Pick<P, Exclude<keyof P, keyof D>>
|
3216
3296
|
& InexactPartial<Pick<P, Extract<keyof P, keyof D>>>
|
3217
3297
|
& InexactPartial<Pick<D, Exclude<keyof D, keyof P>>>
|
3218
3298
|
: never;
|
3219
3299
|
|
3220
|
-
type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D
|
3300
|
+
type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D }
|
3221
3301
|
? Defaultize<MergePropTypes<P, PropTypes.InferProps<T>>, D>
|
3222
|
-
: C extends { propTypes: infer T
|
3223
|
-
|
3224
|
-
|
3225
|
-
? Defaultize<P, D>
|
3226
|
-
: P;
|
3302
|
+
: C extends { propTypes: infer T } ? MergePropTypes<P, PropTypes.InferProps<T>>
|
3303
|
+
: C extends { defaultProps: infer D } ? Defaultize<P, D>
|
3304
|
+
: P;
|
3227
3305
|
|
3228
3306
|
declare global {
|
3229
3307
|
/**
|
@@ -3242,23 +3320,28 @@ declare global {
|
|
3242
3320
|
// reduce the work of the type-checker.
|
3243
3321
|
// TODO: Check impact of making React.ElementType<P = any> = React.JSXElementConstructor<P>
|
3244
3322
|
type ElementType = string | React.JSXElementConstructor<any>;
|
3245
|
-
interface Element extends React.ReactElement<any, any> {
|
3323
|
+
interface Element extends React.ReactElement<any, any> {}
|
3246
3324
|
interface ElementClass extends React.Component<any> {
|
3247
3325
|
render(): React.ReactNode;
|
3248
3326
|
}
|
3249
|
-
interface ElementAttributesProperty {
|
3250
|
-
|
3327
|
+
interface ElementAttributesProperty {
|
3328
|
+
props: {};
|
3329
|
+
}
|
3330
|
+
interface ElementChildrenAttribute {
|
3331
|
+
children: {};
|
3332
|
+
}
|
3251
3333
|
|
3252
3334
|
// We can't recurse forever because `type` can't be self-referential;
|
3253
3335
|
// let's assume it's reasonable to do a single React.lazy() around a single React.memo() / vice-versa
|
3254
|
-
type LibraryManagedAttributes<C, P> = C extends
|
3336
|
+
type LibraryManagedAttributes<C, P> = C extends
|
3337
|
+
React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
|
3255
3338
|
? T extends React.MemoExoticComponent<infer U> | React.LazyExoticComponent<infer U>
|
3256
3339
|
? ReactManagedAttributes<U, P>
|
3257
|
-
|
3340
|
+
: ReactManagedAttributes<T, P>
|
3258
3341
|
: ReactManagedAttributes<C, P>;
|
3259
3342
|
|
3260
|
-
interface IntrinsicAttributes extends React.Attributes {
|
3261
|
-
interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {
|
3343
|
+
interface IntrinsicAttributes extends React.Attributes {}
|
3344
|
+
interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {}
|
3262
3345
|
|
3263
3346
|
interface IntrinsicElements {
|
3264
3347
|
// HTML
|