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