@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/ts5.0/index.d.ts
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
/// <reference path="global.d.ts" />
|
6
6
|
|
7
|
-
import * as CSS from
|
8
|
-
import * as PropTypes from
|
9
|
-
import { Interaction as SchedulerInteraction } from
|
7
|
+
import * as CSS from "csstype";
|
8
|
+
import * as PropTypes from "prop-types";
|
9
|
+
import { Interaction as SchedulerInteraction } from "scheduler/tracing";
|
10
10
|
|
11
11
|
type NativeAnimationEvent = AnimationEvent;
|
12
12
|
type NativeClipboardEvent = ClipboardEvent;
|
@@ -20,8 +20,8 @@ type NativePointerEvent = PointerEvent;
|
|
20
20
|
type NativeTransitionEvent = TransitionEvent;
|
21
21
|
type NativeUIEvent = UIEvent;
|
22
22
|
type NativeWheelEvent = WheelEvent;
|
23
|
-
type Booleanish = boolean |
|
24
|
-
type CrossOrigin =
|
23
|
+
type Booleanish = boolean | "true" | "false";
|
24
|
+
type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined;
|
25
25
|
|
26
26
|
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
27
27
|
// Destructors are only allowed to return void.
|
@@ -38,27 +38,27 @@ declare namespace React {
|
|
38
38
|
// ----------------------------------------------------------------------
|
39
39
|
|
40
40
|
type ElementType<P = any> =
|
41
|
-
{
|
42
|
-
[K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never
|
43
|
-
}[keyof JSX.IntrinsicElements]
|
44
|
-
ComponentType<P>;
|
41
|
+
| {
|
42
|
+
[K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never;
|
43
|
+
}[keyof JSX.IntrinsicElements]
|
44
|
+
| ComponentType<P>;
|
45
45
|
type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
|
46
46
|
|
47
47
|
type JSXElementConstructor<P> =
|
48
48
|
| ((
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
| (new
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
49
|
+
props: P,
|
50
|
+
/**
|
51
|
+
* @deprecated https://legacy.react/ts5.0js.org/docs/legacy-context.html#referencing-context-in-stateless-function-components
|
52
|
+
*/
|
53
|
+
deprecatedLegacyContext?: any,
|
54
|
+
) => ReactElement<any, any> | null)
|
55
|
+
| (new(
|
56
|
+
props: P,
|
57
|
+
/**
|
58
|
+
* @deprecated https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods
|
59
|
+
*/
|
60
|
+
deprecatedLegacyContext?: any,
|
61
|
+
) => Component<any, any>);
|
62
62
|
|
63
63
|
interface RefObject<T> {
|
64
64
|
readonly current: T | null;
|
@@ -87,18 +87,16 @@ declare namespace React {
|
|
87
87
|
type ElementRef<
|
88
88
|
C extends
|
89
89
|
| ForwardRefExoticComponent<any>
|
90
|
-
| { new
|
90
|
+
| { new(props: any): Component<any> }
|
91
91
|
| ((props: any, context?: any) => ReactElement | null)
|
92
|
-
| keyof JSX.IntrinsicElements
|
92
|
+
| keyof JSX.IntrinsicElements,
|
93
93
|
> =
|
94
94
|
// need to check first if `ref` is a valid prop for ts@3.0
|
95
95
|
// otherwise it will infer `{}` instead of `never`
|
96
|
-
"ref" extends keyof ComponentPropsWithRef<C>
|
97
|
-
? NonNullable<ComponentPropsWithRef<C>["ref"]> extends Ref<
|
96
|
+
"ref" extends keyof ComponentPropsWithRef<C> ? NonNullable<ComponentPropsWithRef<C>["ref"]> extends Ref<
|
98
97
|
infer Instance
|
99
|
-
>
|
100
|
-
|
101
|
-
: never
|
98
|
+
> ? Instance
|
99
|
+
: never
|
102
100
|
: never;
|
103
101
|
|
104
102
|
type ComponentState = any;
|
@@ -129,19 +127,22 @@ declare namespace React {
|
|
129
127
|
ref?: LegacyRef<T> | undefined;
|
130
128
|
}
|
131
129
|
|
132
|
-
interface ReactElement<
|
130
|
+
interface ReactElement<
|
131
|
+
P = any,
|
132
|
+
T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>,
|
133
|
+
> {
|
133
134
|
type: T;
|
134
135
|
props: P;
|
135
|
-
key:
|
136
|
+
key: string | null;
|
136
137
|
}
|
137
138
|
|
138
139
|
interface ReactComponentElement<
|
139
140
|
T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>,
|
140
|
-
P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>,
|
141
|
-
> extends ReactElement<P, Exclude<T, number>> {
|
141
|
+
P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, "key" | "ref">>,
|
142
|
+
> extends ReactElement<P, Exclude<T, number>> {}
|
142
143
|
|
143
144
|
interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
|
144
|
-
ref?: (
|
145
|
+
ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
|
145
146
|
}
|
146
147
|
|
147
148
|
type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>;
|
@@ -152,12 +153,14 @@ declare namespace React {
|
|
152
153
|
type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
|
153
154
|
|
154
155
|
// string fallback for custom web-components
|
155
|
-
interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element>
|
156
|
+
interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element>
|
157
|
+
extends ReactElement<P, string>
|
158
|
+
{
|
156
159
|
ref: LegacyRef<T>;
|
157
160
|
}
|
158
161
|
|
159
162
|
// ReactHTML for ReactHTMLElement
|
160
|
-
interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {
|
163
|
+
interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {}
|
161
164
|
|
162
165
|
interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> {
|
163
166
|
type: keyof ReactHTML;
|
@@ -169,7 +172,6 @@ declare namespace React {
|
|
169
172
|
}
|
170
173
|
|
171
174
|
interface ReactPortal extends ReactElement {
|
172
|
-
key: Key | null;
|
173
175
|
children: ReactNode;
|
174
176
|
}
|
175
177
|
|
@@ -184,16 +186,23 @@ declare namespace React {
|
|
184
186
|
*/
|
185
187
|
type SFCFactory<P> = FunctionComponentFactory<P>;
|
186
188
|
|
187
|
-
type FunctionComponentFactory<P> = (
|
189
|
+
type FunctionComponentFactory<P> = (
|
190
|
+
props?: Attributes & P,
|
191
|
+
...children: ReactNode[]
|
192
|
+
) => FunctionComponentElement<P>;
|
188
193
|
|
189
|
-
type ComponentFactory<P, T extends Component<P, ComponentState>> =
|
190
|
-
|
194
|
+
type ComponentFactory<P, T extends Component<P, ComponentState>> = (
|
195
|
+
props?: ClassAttributes<T> & P,
|
196
|
+
...children: ReactNode[]
|
197
|
+
) => CElement<P, T>;
|
191
198
|
|
192
199
|
type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>;
|
193
200
|
type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>;
|
194
201
|
|
195
|
-
type DOMFactory<P extends DOMAttributes<T>, T extends Element> =
|
196
|
-
|
202
|
+
type DOMFactory<P extends DOMAttributes<T>, T extends Element> = (
|
203
|
+
props?: ClassAttributes<T> & P | null,
|
204
|
+
...children: ReactNode[]
|
205
|
+
) => DOMElement<P, T>;
|
197
206
|
|
198
207
|
interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {}
|
199
208
|
|
@@ -202,7 +211,10 @@ declare namespace React {
|
|
202
211
|
}
|
203
212
|
|
204
213
|
interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> {
|
205
|
-
(
|
214
|
+
(
|
215
|
+
props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null,
|
216
|
+
...children: ReactNode[]
|
217
|
+
): ReactSVGElement;
|
206
218
|
}
|
207
219
|
|
208
220
|
/**
|
@@ -239,7 +251,9 @@ declare namespace React {
|
|
239
251
|
| boolean
|
240
252
|
| null
|
241
253
|
| undefined
|
242
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
|
254
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
|
255
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES
|
256
|
+
];
|
243
257
|
|
244
258
|
//
|
245
259
|
// Top Level API
|
@@ -247,18 +261,23 @@ declare namespace React {
|
|
247
261
|
|
248
262
|
// DOM Elements
|
249
263
|
function createFactory<T extends HTMLElement>(
|
250
|
-
type: keyof ReactHTML
|
264
|
+
type: keyof ReactHTML,
|
265
|
+
): HTMLFactory<T>;
|
251
266
|
function createFactory(
|
252
|
-
type: keyof ReactSVG
|
267
|
+
type: keyof ReactSVG,
|
268
|
+
): SVGFactory;
|
253
269
|
function createFactory<P extends DOMAttributes<T>, T extends Element>(
|
254
|
-
type: string
|
270
|
+
type: string,
|
271
|
+
): DOMFactory<P, T>;
|
255
272
|
|
256
273
|
// Custom components
|
257
274
|
function createFactory<P>(type: FunctionComponent<P>): FunctionComponentFactory<P>;
|
258
275
|
function createFactory<P>(
|
259
|
-
type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P
|
276
|
+
type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
|
277
|
+
): CFactory<P, ClassicComponent<P, ComponentState>>;
|
260
278
|
function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
|
261
|
-
type: ClassType<P, T, C
|
279
|
+
type: ClassType<P, T, C>,
|
280
|
+
): CFactory<P, T>;
|
262
281
|
function createFactory<P>(type: ComponentClass<P>): Factory<P>;
|
263
282
|
|
264
283
|
// DOM Elements
|
@@ -266,74 +285,89 @@ declare namespace React {
|
|
266
285
|
function createElement(
|
267
286
|
type: "input",
|
268
287
|
props?: InputHTMLAttributes<HTMLInputElement> & ClassAttributes<HTMLInputElement> | null,
|
269
|
-
...children: ReactNode[]
|
288
|
+
...children: ReactNode[]
|
289
|
+
): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
270
290
|
function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
|
271
291
|
type: keyof ReactHTML,
|
272
292
|
props?: ClassAttributes<T> & P | null,
|
273
|
-
...children: ReactNode[]
|
293
|
+
...children: ReactNode[]
|
294
|
+
): DetailedReactHTMLElement<P, T>;
|
274
295
|
function createElement<P extends SVGAttributes<T>, T extends SVGElement>(
|
275
296
|
type: keyof ReactSVG,
|
276
297
|
props?: ClassAttributes<T> & P | null,
|
277
|
-
...children: ReactNode[]
|
298
|
+
...children: ReactNode[]
|
299
|
+
): ReactSVGElement;
|
278
300
|
function createElement<P extends DOMAttributes<T>, T extends Element>(
|
279
301
|
type: string,
|
280
302
|
props?: ClassAttributes<T> & P | null,
|
281
|
-
...children: ReactNode[]
|
303
|
+
...children: ReactNode[]
|
304
|
+
): DOMElement<P, T>;
|
282
305
|
|
283
306
|
// Custom components
|
284
307
|
|
285
308
|
function createElement<P extends {}>(
|
286
309
|
type: FunctionComponent<P>,
|
287
310
|
props?: Attributes & P | null,
|
288
|
-
...children: ReactNode[]
|
311
|
+
...children: ReactNode[]
|
312
|
+
): FunctionComponentElement<P>;
|
289
313
|
function createElement<P extends {}>(
|
290
314
|
type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
|
291
315
|
props?: ClassAttributes<ClassicComponent<P, ComponentState>> & P | null,
|
292
|
-
...children: ReactNode[]
|
316
|
+
...children: ReactNode[]
|
317
|
+
): CElement<P, ClassicComponent<P, ComponentState>>;
|
293
318
|
function createElement<P extends {}, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
|
294
319
|
type: ClassType<P, T, C>,
|
295
320
|
props?: ClassAttributes<T> & P | null,
|
296
|
-
...children: ReactNode[]
|
321
|
+
...children: ReactNode[]
|
322
|
+
): CElement<P, T>;
|
297
323
|
function createElement<P extends {}>(
|
298
324
|
type: FunctionComponent<P> | ComponentClass<P> | string,
|
299
325
|
props?: Attributes & P | null,
|
300
|
-
...children: ReactNode[]
|
326
|
+
...children: ReactNode[]
|
327
|
+
): ReactElement<P>;
|
301
328
|
|
302
329
|
// DOM Elements
|
303
330
|
// ReactHTMLElement
|
304
331
|
function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
|
305
332
|
element: DetailedReactHTMLElement<P, T>,
|
306
333
|
props?: P,
|
307
|
-
...children: ReactNode[]
|
334
|
+
...children: ReactNode[]
|
335
|
+
): DetailedReactHTMLElement<P, T>;
|
308
336
|
// ReactHTMLElement, less specific
|
309
337
|
function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
|
310
338
|
element: ReactHTMLElement<T>,
|
311
339
|
props?: P,
|
312
|
-
...children: ReactNode[]
|
340
|
+
...children: ReactNode[]
|
341
|
+
): ReactHTMLElement<T>;
|
313
342
|
// SVGElement
|
314
343
|
function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>(
|
315
344
|
element: ReactSVGElement,
|
316
345
|
props?: P,
|
317
|
-
...children: ReactNode[]
|
346
|
+
...children: ReactNode[]
|
347
|
+
): ReactSVGElement;
|
318
348
|
// DOM Element (has to be the last, because type checking stops at first overload that fits)
|
319
349
|
function cloneElement<P extends DOMAttributes<T>, T extends Element>(
|
320
350
|
element: DOMElement<P, T>,
|
321
351
|
props?: DOMAttributes<T> & P,
|
322
|
-
...children: ReactNode[]
|
352
|
+
...children: ReactNode[]
|
353
|
+
): DOMElement<P, T>;
|
323
354
|
|
324
355
|
// Custom components
|
325
356
|
function cloneElement<P>(
|
326
357
|
element: FunctionComponentElement<P>,
|
327
358
|
props?: Partial<P> & Attributes,
|
328
|
-
...children: ReactNode[]
|
359
|
+
...children: ReactNode[]
|
360
|
+
): FunctionComponentElement<P>;
|
329
361
|
function cloneElement<P, T extends Component<P, ComponentState>>(
|
330
362
|
element: CElement<P, T>,
|
331
363
|
props?: Partial<P> & ClassAttributes<T>,
|
332
|
-
...children: ReactNode[]
|
364
|
+
...children: ReactNode[]
|
365
|
+
): CElement<P, T>;
|
333
366
|
function cloneElement<P>(
|
334
367
|
element: ReactElement<P>,
|
335
368
|
props?: Partial<P> & Attributes,
|
336
|
-
...children: ReactNode[]
|
369
|
+
...children: ReactNode[]
|
370
|
+
): ReactElement<P>;
|
337
371
|
|
338
372
|
// Context via RenderProps
|
339
373
|
interface ProviderProps<T> {
|
@@ -359,7 +393,7 @@ declare namespace React {
|
|
359
393
|
/**
|
360
394
|
* **NOTE**: Exotic components are not callable.
|
361
395
|
*/
|
362
|
-
(props: P):
|
396
|
+
(props: P): ReactElement | null;
|
363
397
|
readonly $$typeof: symbol;
|
364
398
|
}
|
365
399
|
|
@@ -392,8 +426,10 @@ declare namespace React {
|
|
392
426
|
|
393
427
|
// Sync with `ReactChildren` until `ReactChildren` is removed.
|
394
428
|
const Children: {
|
395
|
-
map<T, C>(
|
396
|
-
C
|
429
|
+
map<T, C>(
|
430
|
+
children: C | ReadonlyArray<C>,
|
431
|
+
fn: (child: C, index: number) => T,
|
432
|
+
): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
|
397
433
|
forEach<C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => void): void;
|
398
434
|
count(children: any): number;
|
399
435
|
only<C>(children: C): C extends any[] ? never : C;
|
@@ -439,7 +475,7 @@ declare namespace React {
|
|
439
475
|
type ReactInstance = Component<any> | Element;
|
440
476
|
|
441
477
|
// Base component for plain JS classes
|
442
|
-
interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {
|
478
|
+
interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {}
|
443
479
|
class Component<P, S> {
|
444
480
|
// tslint won't let me format the sample code in a way that vscode likes it :(
|
445
481
|
/**
|
@@ -492,8 +528,8 @@ declare namespace React {
|
|
492
528
|
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
|
493
529
|
// Also, the ` | S` allows intellisense to not be dumbisense
|
494
530
|
setState<K extends keyof S>(
|
495
|
-
state: ((prevState: Readonly<S>, props: Readonly<P>) =>
|
496
|
-
callback?: () => void
|
531
|
+
state: ((prevState: Readonly<S>, props: Readonly<P>) => Pick<S, K> | S | null) | (Pick<S, K> | S | null),
|
532
|
+
callback?: () => void,
|
497
533
|
): void;
|
498
534
|
|
499
535
|
forceUpdate(callback?: () => void): void;
|
@@ -506,11 +542,11 @@ declare namespace React {
|
|
506
542
|
* https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs
|
507
543
|
*/
|
508
544
|
refs: {
|
509
|
-
[key: string]: ReactInstance
|
545
|
+
[key: string]: ReactInstance;
|
510
546
|
};
|
511
547
|
}
|
512
548
|
|
513
|
-
class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {
|
549
|
+
class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {}
|
514
550
|
|
515
551
|
interface ClassicComponent<P = {}, S = {}> extends Component<P, S> {
|
516
552
|
replaceState(nextState: S, callback?: () => void): void;
|
@@ -570,7 +606,7 @@ declare namespace React {
|
|
570
606
|
}
|
571
607
|
|
572
608
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
573
|
-
new
|
609
|
+
new(props: P, context?: any): Component<P, S>;
|
574
610
|
propTypes?: WeakValidationMap<P> | undefined;
|
575
611
|
contextType?: Context<any> | undefined;
|
576
612
|
contextTypes?: ValidationMap<any> | undefined;
|
@@ -580,7 +616,7 @@ declare namespace React {
|
|
580
616
|
}
|
581
617
|
|
582
618
|
interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
|
583
|
-
new
|
619
|
+
new(props: P, context?: any): ClassicComponent<P, ComponentState>;
|
584
620
|
getDefaultProps?(): P;
|
585
621
|
}
|
586
622
|
|
@@ -590,8 +626,8 @@ declare namespace React {
|
|
590
626
|
* See https://github.com/Microsoft/TypeScript/issues/7234 for more info.
|
591
627
|
*/
|
592
628
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
593
|
-
C
|
594
|
-
(new
|
629
|
+
& C
|
630
|
+
& (new(props: P, context?: any) => T);
|
595
631
|
|
596
632
|
//
|
597
633
|
// Component Specs and Lifecycle
|
@@ -789,23 +825,24 @@ declare namespace React {
|
|
789
825
|
propTypes?: WeakValidationMap<P> | undefined;
|
790
826
|
}
|
791
827
|
|
792
|
-
function forwardRef<T, P = {}>(
|
828
|
+
function forwardRef<T, P = {}>(
|
829
|
+
render: ForwardRefRenderFunction<T, P>,
|
830
|
+
): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
|
793
831
|
|
794
832
|
/** Ensures that the props do not include ref at all */
|
795
833
|
type PropsWithoutRef<P> =
|
796
834
|
// Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
|
797
835
|
// see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
|
798
836
|
// https://github.com/Microsoft/TypeScript/issues/28339
|
799
|
-
P extends any ? (
|
837
|
+
P extends any ? ("ref" extends keyof P ? Omit<P, "ref"> : P) : P;
|
800
838
|
/** Ensures that the props do not include string ref, which cannot be forwarded */
|
801
839
|
type PropsWithRef<P> =
|
802
840
|
// Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}.
|
803
|
-
|
841
|
+
"ref" extends keyof P
|
804
842
|
? P extends { ref?: infer R | undefined }
|
805
|
-
? string extends R
|
806
|
-
? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
|
807
|
-
: P
|
843
|
+
? string extends R ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
|
808
844
|
: P
|
845
|
+
: P
|
809
846
|
: P;
|
810
847
|
|
811
848
|
type PropsWithChildren<P = unknown> = P & { children?: ReactNode | undefined };
|
@@ -814,26 +851,20 @@ declare namespace React {
|
|
814
851
|
* NOTE: prefer ComponentPropsWithRef, if the ref is forwarded,
|
815
852
|
* or ComponentPropsWithoutRef when refs are not supported.
|
816
853
|
*/
|
817
|
-
type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> =
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
|
826
|
-
: PropsWithRef<ComponentProps<T>>;
|
827
|
-
type ComponentPropsWithoutRef<T extends ElementType> =
|
828
|
-
PropsWithoutRef<ComponentProps<T>>;
|
854
|
+
type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends
|
855
|
+
JSXElementConstructor<infer P> ? P
|
856
|
+
: T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T]
|
857
|
+
: {};
|
858
|
+
type ComponentPropsWithRef<T extends ElementType> = T extends (new(props: infer P) => Component<any, any>)
|
859
|
+
? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
|
860
|
+
: PropsWithRef<ComponentProps<T>>;
|
861
|
+
type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;
|
829
862
|
|
830
863
|
type ComponentRef<T extends ElementType> = T extends NamedExoticComponent<
|
831
864
|
ComponentPropsWithoutRef<T> & RefAttributes<infer Method>
|
832
|
-
>
|
833
|
-
? Method
|
834
|
-
:
|
835
|
-
? Method
|
836
|
-
: never;
|
865
|
+
> ? Method
|
866
|
+
: ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
|
867
|
+
: never;
|
837
868
|
|
838
869
|
// will show `Memo(${Component.displayName || Component.name})` in devtools by default,
|
839
870
|
// but can be given its own specific name
|
@@ -843,11 +874,11 @@ declare namespace React {
|
|
843
874
|
|
844
875
|
function memo<P extends object>(
|
845
876
|
Component: FunctionComponent<P>,
|
846
|
-
propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean
|
877
|
+
propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean,
|
847
878
|
): NamedExoticComponent<P>;
|
848
879
|
function memo<T extends ComponentType<any>>(
|
849
880
|
Component: T,
|
850
|
-
propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean
|
881
|
+
propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean,
|
851
882
|
): MemoExoticComponent<T>;
|
852
883
|
|
853
884
|
type LazyExoticComponent<T extends ComponentType<any>> = ExoticComponent<ComponentPropsWithRef<T>> & {
|
@@ -855,7 +886,7 @@ declare namespace React {
|
|
855
886
|
};
|
856
887
|
|
857
888
|
function lazy<T extends ComponentType<any>>(
|
858
|
-
factory: () => Promise<{ default: T }
|
889
|
+
factory: () => Promise<{ default: T }>,
|
859
890
|
): LazyExoticComponent<T>;
|
860
891
|
|
861
892
|
//
|
@@ -880,12 +911,12 @@ declare namespace React {
|
|
880
911
|
type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
|
881
912
|
type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never;
|
882
913
|
// The identity check is done with the SameValue algorithm (Object.is), which is stricter than ===
|
883
|
-
type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> =
|
884
|
-
|
914
|
+
type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> = R extends ReducerWithoutAction<infer S> ? S
|
915
|
+
: never;
|
885
916
|
type DependencyList = ReadonlyArray<unknown>;
|
886
917
|
|
887
918
|
// NOTE: callbacks are _only_ allowed to return either void, or a destructor.
|
888
|
-
type EffectCallback = () =>
|
919
|
+
type EffectCallback = () => void | Destructor;
|
889
920
|
|
890
921
|
interface MutableRefObject<T> {
|
891
922
|
current: T;
|
@@ -899,7 +930,7 @@ declare namespace React {
|
|
899
930
|
* @version 16.8.0
|
900
931
|
* @see https://react.dev/reference/react/useContext
|
901
932
|
*/
|
902
|
-
function useContext<T>(context: Context<T
|
933
|
+
function useContext<T>(context: Context<T> /*, (not public API) observedBits?: number|boolean */): T;
|
903
934
|
/**
|
904
935
|
* Returns a stateful value, and a function to update it.
|
905
936
|
*
|
@@ -929,7 +960,7 @@ declare namespace React {
|
|
929
960
|
function useReducer<R extends ReducerWithoutAction<any>, I>(
|
930
961
|
reducer: R,
|
931
962
|
initializerArg: I,
|
932
|
-
initializer: (arg: I) => ReducerStateWithoutAction<R
|
963
|
+
initializer: (arg: I) => ReducerStateWithoutAction<R>,
|
933
964
|
): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
|
934
965
|
/**
|
935
966
|
* An alternative to `useState`.
|
@@ -945,7 +976,7 @@ declare namespace React {
|
|
945
976
|
function useReducer<R extends ReducerWithoutAction<any>>(
|
946
977
|
reducer: R,
|
947
978
|
initializerArg: ReducerStateWithoutAction<R>,
|
948
|
-
initializer?: undefined
|
979
|
+
initializer?: undefined,
|
949
980
|
): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
|
950
981
|
/**
|
951
982
|
* An alternative to `useState`.
|
@@ -963,7 +994,7 @@ declare namespace React {
|
|
963
994
|
function useReducer<R extends Reducer<any, any>, I>(
|
964
995
|
reducer: R,
|
965
996
|
initializerArg: I & ReducerState<R>,
|
966
|
-
initializer: (arg: I & ReducerState<R>) => ReducerState<R
|
997
|
+
initializer: (arg: I & ReducerState<R>) => ReducerState<R>,
|
967
998
|
): [ReducerState<R>, Dispatch<ReducerAction<R>>];
|
968
999
|
/**
|
969
1000
|
* An alternative to `useState`.
|
@@ -979,7 +1010,7 @@ declare namespace React {
|
|
979
1010
|
function useReducer<R extends Reducer<any, any>, I>(
|
980
1011
|
reducer: R,
|
981
1012
|
initializerArg: I,
|
982
|
-
initializer: (arg: I) => ReducerState<R
|
1013
|
+
initializer: (arg: I) => ReducerState<R>,
|
983
1014
|
): [ReducerState<R>, Dispatch<ReducerAction<R>>];
|
984
1015
|
/**
|
985
1016
|
* An alternative to `useState`.
|
@@ -1004,7 +1035,7 @@ declare namespace React {
|
|
1004
1035
|
function useReducer<R extends Reducer<any, any>>(
|
1005
1036
|
reducer: R,
|
1006
1037
|
initialState: ReducerState<R>,
|
1007
|
-
initializer?: undefined
|
1038
|
+
initializer?: undefined,
|
1008
1039
|
): [ReducerState<R>, Dispatch<ReducerAction<R>>];
|
1009
1040
|
/**
|
1010
1041
|
* `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
|
@@ -1031,7 +1062,7 @@ declare namespace React {
|
|
1031
1062
|
* @version 16.8.0
|
1032
1063
|
* @see https://react.dev/reference/react/useRef
|
1033
1064
|
*/
|
1034
|
-
function useRef<T>(initialValue: T|null): RefObject<T>;
|
1065
|
+
function useRef<T>(initialValue: T | null): RefObject<T>;
|
1035
1066
|
// convenience overload for potentially undefined initialValue / call with 0 arguments
|
1036
1067
|
// has a default to stop it from defaulting to {} instead
|
1037
1068
|
/**
|
@@ -1079,7 +1110,7 @@ declare namespace React {
|
|
1079
1110
|
* @version 16.8.0
|
1080
1111
|
* @see https://react.dev/reference/react/useImperativeHandle
|
1081
1112
|
*/
|
1082
|
-
function useImperativeHandle<T, R extends T>(ref: Ref<T
|
1113
|
+
function useImperativeHandle<T, R extends T>(ref: Ref<T> | undefined, init: () => R, deps?: DependencyList): void;
|
1083
1114
|
// I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key
|
1084
1115
|
// useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y.
|
1085
1116
|
/**
|
@@ -1174,7 +1205,7 @@ declare namespace React {
|
|
1174
1205
|
*
|
1175
1206
|
* @see https://github.com/facebook/react/pull/21913
|
1176
1207
|
*/
|
1177
|
-
|
1208
|
+
export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1178
1209
|
|
1179
1210
|
/**
|
1180
1211
|
* @param subscribe
|
@@ -1241,7 +1272,7 @@ declare namespace React {
|
|
1241
1272
|
twist: number;
|
1242
1273
|
width: number;
|
1243
1274
|
height: number;
|
1244
|
-
pointerType:
|
1275
|
+
pointerType: "mouse" | "pen" | "touch";
|
1245
1276
|
isPrimary: boolean;
|
1246
1277
|
}
|
1247
1278
|
|
@@ -1261,7 +1292,21 @@ declare namespace React {
|
|
1261
1292
|
target: EventTarget & T;
|
1262
1293
|
}
|
1263
1294
|
|
1264
|
-
export type ModifierKey =
|
1295
|
+
export type ModifierKey =
|
1296
|
+
| "Alt"
|
1297
|
+
| "AltGraph"
|
1298
|
+
| "CapsLock"
|
1299
|
+
| "Control"
|
1300
|
+
| "Fn"
|
1301
|
+
| "FnLock"
|
1302
|
+
| "Hyper"
|
1303
|
+
| "Meta"
|
1304
|
+
| "NumLock"
|
1305
|
+
| "ScrollLock"
|
1306
|
+
| "Shift"
|
1307
|
+
| "Super"
|
1308
|
+
| "Symbol"
|
1309
|
+
| "SymbolLock";
|
1265
1310
|
|
1266
1311
|
interface KeyboardEvent<T = Element> extends UIEvent<T, NativeKeyboardEvent> {
|
1267
1312
|
altKey: boolean;
|
@@ -1603,287 +1648,298 @@ declare namespace React {
|
|
1603
1648
|
// All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/
|
1604
1649
|
interface AriaAttributes {
|
1605
1650
|
/** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */
|
1606
|
-
|
1651
|
+
"aria-activedescendant"?: string | undefined;
|
1607
1652
|
/** 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. */
|
1608
|
-
|
1653
|
+
"aria-atomic"?: Booleanish | undefined;
|
1609
1654
|
/**
|
1610
1655
|
* 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
|
1611
1656
|
* presented if they are made.
|
1612
1657
|
*/
|
1613
|
-
|
1658
|
+
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
1614
1659
|
/** 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. */
|
1615
1660
|
/**
|
1616
1661
|
* Defines a string value that labels the current element, which is intended to be converted into Braille.
|
1617
1662
|
* @see aria-label.
|
1618
1663
|
*/
|
1619
|
-
|
1664
|
+
"aria-braillelabel"?: string | undefined;
|
1620
1665
|
/**
|
1621
1666
|
* Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.
|
1622
1667
|
* @see aria-roledescription.
|
1623
1668
|
*/
|
1624
|
-
|
1625
|
-
|
1669
|
+
"aria-brailleroledescription"?: string | undefined;
|
1670
|
+
"aria-busy"?: Booleanish | undefined;
|
1626
1671
|
/**
|
1627
1672
|
* Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
|
1628
1673
|
* @see aria-pressed @see aria-selected.
|
1629
1674
|
*/
|
1630
|
-
|
1675
|
+
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
|
1631
1676
|
/**
|
1632
1677
|
* Defines the total number of columns in a table, grid, or treegrid.
|
1633
1678
|
* @see aria-colindex.
|
1634
1679
|
*/
|
1635
|
-
|
1680
|
+
"aria-colcount"?: number | undefined;
|
1636
1681
|
/**
|
1637
1682
|
* Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
|
1638
1683
|
* @see aria-colcount @see aria-colspan.
|
1639
1684
|
*/
|
1640
|
-
|
1685
|
+
"aria-colindex"?: number | undefined;
|
1641
1686
|
/**
|
1642
1687
|
* Defines a human readable text alternative of aria-colindex.
|
1643
1688
|
* @see aria-rowindextext.
|
1644
1689
|
*/
|
1645
|
-
|
1690
|
+
"aria-colindextext"?: string | undefined;
|
1646
1691
|
/**
|
1647
1692
|
* Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
|
1648
1693
|
* @see aria-colindex @see aria-rowspan.
|
1649
1694
|
*/
|
1650
|
-
|
1695
|
+
"aria-colspan"?: number | undefined;
|
1651
1696
|
/**
|
1652
1697
|
* Identifies the element (or elements) whose contents or presence are controlled by the current element.
|
1653
1698
|
* @see aria-owns.
|
1654
1699
|
*/
|
1655
|
-
|
1700
|
+
"aria-controls"?: string | undefined;
|
1656
1701
|
/** Indicates the element that represents the current item within a container or set of related elements. */
|
1657
|
-
|
1702
|
+
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
|
1658
1703
|
/**
|
1659
1704
|
* Identifies the element (or elements) that describes the object.
|
1660
1705
|
* @see aria-labelledby
|
1661
1706
|
*/
|
1662
|
-
|
1707
|
+
"aria-describedby"?: string | undefined;
|
1663
1708
|
/**
|
1664
1709
|
* Defines a string value that describes or annotates the current element.
|
1665
1710
|
* @see related aria-describedby.
|
1666
1711
|
*/
|
1667
|
-
|
1712
|
+
"aria-description"?: string | undefined;
|
1668
1713
|
/**
|
1669
1714
|
* Identifies the element that provides a detailed, extended description for the object.
|
1670
1715
|
* @see aria-describedby.
|
1671
1716
|
*/
|
1672
|
-
|
1717
|
+
"aria-details"?: string | undefined;
|
1673
1718
|
/**
|
1674
1719
|
* Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
|
1675
1720
|
* @see aria-hidden @see aria-readonly.
|
1676
1721
|
*/
|
1677
|
-
|
1722
|
+
"aria-disabled"?: Booleanish | undefined;
|
1678
1723
|
/**
|
1679
1724
|
* Indicates what functions can be performed when a dragged object is released on the drop target.
|
1680
1725
|
* @deprecated in ARIA 1.1
|
1681
1726
|
*/
|
1682
|
-
|
1727
|
+
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
|
1683
1728
|
/**
|
1684
1729
|
* Identifies the element that provides an error message for the object.
|
1685
1730
|
* @see aria-invalid @see aria-describedby.
|
1686
1731
|
*/
|
1687
|
-
|
1732
|
+
"aria-errormessage"?: string | undefined;
|
1688
1733
|
/** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */
|
1689
|
-
|
1734
|
+
"aria-expanded"?: Booleanish | undefined;
|
1690
1735
|
/**
|
1691
1736
|
* Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,
|
1692
1737
|
* allows assistive technology to override the general default of reading in document source order.
|
1693
1738
|
*/
|
1694
|
-
|
1739
|
+
"aria-flowto"?: string | undefined;
|
1695
1740
|
/**
|
1696
1741
|
* Indicates an element's "grabbed" state in a drag-and-drop operation.
|
1697
1742
|
* @deprecated in ARIA 1.1
|
1698
1743
|
*/
|
1699
|
-
|
1744
|
+
"aria-grabbed"?: Booleanish | undefined;
|
1700
1745
|
/** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */
|
1701
|
-
|
1746
|
+
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
1702
1747
|
/**
|
1703
1748
|
* Indicates whether the element is exposed to an accessibility API.
|
1704
1749
|
* @see aria-disabled.
|
1705
1750
|
*/
|
1706
|
-
|
1751
|
+
"aria-hidden"?: Booleanish | undefined;
|
1707
1752
|
/**
|
1708
1753
|
* Indicates the entered value does not conform to the format expected by the application.
|
1709
1754
|
* @see aria-errormessage.
|
1710
1755
|
*/
|
1711
|
-
|
1756
|
+
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
1712
1757
|
/** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */
|
1713
|
-
|
1758
|
+
"aria-keyshortcuts"?: string | undefined;
|
1714
1759
|
/**
|
1715
1760
|
* Defines a string value that labels the current element.
|
1716
1761
|
* @see aria-labelledby.
|
1717
1762
|
*/
|
1718
|
-
|
1763
|
+
"aria-label"?: string | undefined;
|
1719
1764
|
/**
|
1720
1765
|
* Identifies the element (or elements) that labels the current element.
|
1721
1766
|
* @see aria-describedby.
|
1722
1767
|
*/
|
1723
|
-
|
1768
|
+
"aria-labelledby"?: string | undefined;
|
1724
1769
|
/** Defines the hierarchical level of an element within a structure. */
|
1725
|
-
|
1770
|
+
"aria-level"?: number | undefined;
|
1726
1771
|
/** 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. */
|
1727
|
-
|
1772
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
1728
1773
|
/** Indicates whether an element is modal when displayed. */
|
1729
|
-
|
1774
|
+
"aria-modal"?: Booleanish | undefined;
|
1730
1775
|
/** Indicates whether a text box accepts multiple lines of input or only a single line. */
|
1731
|
-
|
1776
|
+
"aria-multiline"?: Booleanish | undefined;
|
1732
1777
|
/** Indicates that the user may select more than one item from the current selectable descendants. */
|
1733
|
-
|
1778
|
+
"aria-multiselectable"?: Booleanish | undefined;
|
1734
1779
|
/** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */
|
1735
|
-
|
1780
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
1736
1781
|
/**
|
1737
1782
|
* Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship
|
1738
1783
|
* between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
|
1739
1784
|
* @see aria-controls.
|
1740
1785
|
*/
|
1741
|
-
|
1786
|
+
"aria-owns"?: string | undefined;
|
1742
1787
|
/**
|
1743
1788
|
* Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.
|
1744
1789
|
* A hint could be a sample value or a brief description of the expected format.
|
1745
1790
|
*/
|
1746
|
-
|
1791
|
+
"aria-placeholder"?: string | undefined;
|
1747
1792
|
/**
|
1748
1793
|
* 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.
|
1749
1794
|
* @see aria-setsize.
|
1750
1795
|
*/
|
1751
|
-
|
1796
|
+
"aria-posinset"?: number | undefined;
|
1752
1797
|
/**
|
1753
1798
|
* Indicates the current "pressed" state of toggle buttons.
|
1754
1799
|
* @see aria-checked @see aria-selected.
|
1755
1800
|
*/
|
1756
|
-
|
1801
|
+
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
|
1757
1802
|
/**
|
1758
1803
|
* Indicates that the element is not editable, but is otherwise operable.
|
1759
1804
|
* @see aria-disabled.
|
1760
1805
|
*/
|
1761
|
-
|
1806
|
+
"aria-readonly"?: Booleanish | undefined;
|
1762
1807
|
/**
|
1763
1808
|
* Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
|
1764
1809
|
* @see aria-atomic.
|
1765
1810
|
*/
|
1766
|
-
|
1811
|
+
"aria-relevant"?:
|
1812
|
+
| "additions"
|
1813
|
+
| "additions removals"
|
1814
|
+
| "additions text"
|
1815
|
+
| "all"
|
1816
|
+
| "removals"
|
1817
|
+
| "removals additions"
|
1818
|
+
| "removals text"
|
1819
|
+
| "text"
|
1820
|
+
| "text additions"
|
1821
|
+
| "text removals"
|
1822
|
+
| undefined;
|
1767
1823
|
/** Indicates that user input is required on the element before a form may be submitted. */
|
1768
|
-
|
1824
|
+
"aria-required"?: Booleanish | undefined;
|
1769
1825
|
/** Defines a human-readable, author-localized description for the role of an element. */
|
1770
|
-
|
1826
|
+
"aria-roledescription"?: string | undefined;
|
1771
1827
|
/**
|
1772
1828
|
* Defines the total number of rows in a table, grid, or treegrid.
|
1773
1829
|
* @see aria-rowindex.
|
1774
1830
|
*/
|
1775
|
-
|
1831
|
+
"aria-rowcount"?: number | undefined;
|
1776
1832
|
/**
|
1777
1833
|
* Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
|
1778
1834
|
* @see aria-rowcount @see aria-rowspan.
|
1779
1835
|
*/
|
1780
|
-
|
1836
|
+
"aria-rowindex"?: number | undefined;
|
1781
1837
|
/**
|
1782
1838
|
* Defines a human readable text alternative of aria-rowindex.
|
1783
1839
|
* @see aria-colindextext.
|
1784
1840
|
*/
|
1785
|
-
|
1841
|
+
"aria-rowindextext"?: string | undefined;
|
1786
1842
|
/**
|
1787
1843
|
* Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
|
1788
1844
|
* @see aria-rowindex @see aria-colspan.
|
1789
1845
|
*/
|
1790
|
-
|
1846
|
+
"aria-rowspan"?: number | undefined;
|
1791
1847
|
/**
|
1792
1848
|
* Indicates the current "selected" state of various widgets.
|
1793
1849
|
* @see aria-checked @see aria-pressed.
|
1794
1850
|
*/
|
1795
|
-
|
1851
|
+
"aria-selected"?: Booleanish | undefined;
|
1796
1852
|
/**
|
1797
1853
|
* 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.
|
1798
1854
|
* @see aria-posinset.
|
1799
1855
|
*/
|
1800
|
-
|
1856
|
+
"aria-setsize"?: number | undefined;
|
1801
1857
|
/** Indicates if items in a table or grid are sorted in ascending or descending order. */
|
1802
|
-
|
1858
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
1803
1859
|
/** Defines the maximum allowed value for a range widget. */
|
1804
|
-
|
1860
|
+
"aria-valuemax"?: number | undefined;
|
1805
1861
|
/** Defines the minimum allowed value for a range widget. */
|
1806
|
-
|
1862
|
+
"aria-valuemin"?: number | undefined;
|
1807
1863
|
/**
|
1808
1864
|
* Defines the current value for a range widget.
|
1809
1865
|
* @see aria-valuetext.
|
1810
1866
|
*/
|
1811
|
-
|
1867
|
+
"aria-valuenow"?: number | undefined;
|
1812
1868
|
/** Defines the human readable text alternative of aria-valuenow for a range widget. */
|
1813
|
-
|
1869
|
+
"aria-valuetext"?: string | undefined;
|
1814
1870
|
}
|
1815
1871
|
|
1816
1872
|
// All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions
|
1817
1873
|
type AriaRole =
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
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
|
-
|
|
1874
|
+
| "alert"
|
1875
|
+
| "alertdialog"
|
1876
|
+
| "application"
|
1877
|
+
| "article"
|
1878
|
+
| "banner"
|
1879
|
+
| "button"
|
1880
|
+
| "cell"
|
1881
|
+
| "checkbox"
|
1882
|
+
| "columnheader"
|
1883
|
+
| "combobox"
|
1884
|
+
| "complementary"
|
1885
|
+
| "contentinfo"
|
1886
|
+
| "definition"
|
1887
|
+
| "dialog"
|
1888
|
+
| "directory"
|
1889
|
+
| "document"
|
1890
|
+
| "feed"
|
1891
|
+
| "figure"
|
1892
|
+
| "form"
|
1893
|
+
| "grid"
|
1894
|
+
| "gridcell"
|
1895
|
+
| "group"
|
1896
|
+
| "heading"
|
1897
|
+
| "img"
|
1898
|
+
| "link"
|
1899
|
+
| "list"
|
1900
|
+
| "listbox"
|
1901
|
+
| "listitem"
|
1902
|
+
| "log"
|
1903
|
+
| "main"
|
1904
|
+
| "marquee"
|
1905
|
+
| "math"
|
1906
|
+
| "menu"
|
1907
|
+
| "menubar"
|
1908
|
+
| "menuitem"
|
1909
|
+
| "menuitemcheckbox"
|
1910
|
+
| "menuitemradio"
|
1911
|
+
| "navigation"
|
1912
|
+
| "none"
|
1913
|
+
| "note"
|
1914
|
+
| "option"
|
1915
|
+
| "presentation"
|
1916
|
+
| "progressbar"
|
1917
|
+
| "radio"
|
1918
|
+
| "radiogroup"
|
1919
|
+
| "region"
|
1920
|
+
| "row"
|
1921
|
+
| "rowgroup"
|
1922
|
+
| "rowheader"
|
1923
|
+
| "scrollbar"
|
1924
|
+
| "search"
|
1925
|
+
| "searchbox"
|
1926
|
+
| "separator"
|
1927
|
+
| "slider"
|
1928
|
+
| "spinbutton"
|
1929
|
+
| "status"
|
1930
|
+
| "switch"
|
1931
|
+
| "tab"
|
1932
|
+
| "table"
|
1933
|
+
| "tablist"
|
1934
|
+
| "tabpanel"
|
1935
|
+
| "term"
|
1936
|
+
| "textbox"
|
1937
|
+
| "timer"
|
1938
|
+
| "toolbar"
|
1939
|
+
| "tooltip"
|
1940
|
+
| "tree"
|
1941
|
+
| "treegrid"
|
1942
|
+
| "treeitem"
|
1887
1943
|
| (string & {});
|
1888
1944
|
|
1889
1945
|
interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
|
@@ -1911,7 +1967,7 @@ declare namespace React {
|
|
1911
1967
|
style?: CSSProperties | undefined;
|
1912
1968
|
tabIndex?: number | undefined;
|
1913
1969
|
title?: string | undefined;
|
1914
|
-
translate?:
|
1970
|
+
translate?: "yes" | "no" | undefined;
|
1915
1971
|
|
1916
1972
|
// Unknown
|
1917
1973
|
radioGroup?: string | undefined; // <command>, <menuitem>
|
@@ -1944,14 +2000,14 @@ declare namespace React {
|
|
1944
2000
|
itemRef?: string | undefined;
|
1945
2001
|
results?: number | undefined;
|
1946
2002
|
security?: string | undefined;
|
1947
|
-
unselectable?:
|
2003
|
+
unselectable?: "on" | "off" | undefined;
|
1948
2004
|
|
1949
2005
|
// Living Standard
|
1950
2006
|
/**
|
1951
2007
|
* Hints at the type of data that might be entered by the user while editing the element or its contents
|
1952
2008
|
* @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute
|
1953
2009
|
*/
|
1954
|
-
inputMode?:
|
2010
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
1955
2011
|
/**
|
1956
2012
|
* Specify that a standard HTML element should behave like a defined custom built-in element
|
1957
2013
|
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is
|
@@ -1973,7 +2029,9 @@ declare namespace React {
|
|
1973
2029
|
action?:
|
1974
2030
|
| string
|
1975
2031
|
| undefined
|
1976
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2032
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2033
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2034
|
+
];
|
1977
2035
|
allowFullScreen?: boolean | undefined;
|
1978
2036
|
allowTransparency?: boolean | undefined;
|
1979
2037
|
alt?: string | undefined;
|
@@ -1981,7 +2039,7 @@ declare namespace React {
|
|
1981
2039
|
async?: boolean | undefined;
|
1982
2040
|
autoComplete?: string | undefined;
|
1983
2041
|
autoPlay?: boolean | undefined;
|
1984
|
-
capture?: boolean |
|
2042
|
+
capture?: boolean | "user" | "environment" | undefined;
|
1985
2043
|
cellPadding?: number | string | undefined;
|
1986
2044
|
cellSpacing?: number | string | undefined;
|
1987
2045
|
charSet?: string | undefined;
|
@@ -2005,7 +2063,9 @@ declare namespace React {
|
|
2005
2063
|
formAction?:
|
2006
2064
|
| string
|
2007
2065
|
| undefined
|
2008
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2066
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2067
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2068
|
+
];
|
2009
2069
|
formEncType?: string | undefined;
|
2010
2070
|
formMethod?: string | undefined;
|
2011
2071
|
formNoValidate?: boolean | undefined;
|
@@ -2079,21 +2139,21 @@ declare namespace React {
|
|
2079
2139
|
}
|
2080
2140
|
|
2081
2141
|
type HTMLAttributeReferrerPolicy =
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2142
|
+
| ""
|
2143
|
+
| "no-referrer"
|
2144
|
+
| "no-referrer-when-downgrade"
|
2145
|
+
| "origin"
|
2146
|
+
| "origin-when-cross-origin"
|
2147
|
+
| "same-origin"
|
2148
|
+
| "strict-origin"
|
2149
|
+
| "strict-origin-when-cross-origin"
|
2150
|
+
| "unsafe-url";
|
2091
2151
|
|
2092
2152
|
type HTMLAttributeAnchorTarget =
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2153
|
+
| "_self"
|
2154
|
+
| "_blank"
|
2155
|
+
| "_parent"
|
2156
|
+
| "_top"
|
2097
2157
|
| (string & {});
|
2098
2158
|
|
2099
2159
|
interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
|
@@ -2135,14 +2195,16 @@ declare namespace React {
|
|
2135
2195
|
form?: string | undefined;
|
2136
2196
|
formAction?:
|
2137
2197
|
| string
|
2138
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2198
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2199
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2200
|
+
]
|
2139
2201
|
| undefined;
|
2140
2202
|
formEncType?: string | undefined;
|
2141
2203
|
formMethod?: string | undefined;
|
2142
2204
|
formNoValidate?: boolean | undefined;
|
2143
2205
|
formTarget?: string | undefined;
|
2144
2206
|
name?: string | undefined;
|
2145
|
-
type?:
|
2207
|
+
type?: "submit" | "reset" | "button" | undefined;
|
2146
2208
|
value?: string | ReadonlyArray<string> | number | undefined;
|
2147
2209
|
}
|
2148
2210
|
|
@@ -2175,8 +2237,8 @@ declare namespace React {
|
|
2175
2237
|
}
|
2176
2238
|
|
2177
2239
|
interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
|
2178
|
-
onCancel?: ReactEventHandler<T> |
|
2179
|
-
onClose?: ReactEventHandler<T> |
|
2240
|
+
onCancel?: ReactEventHandler<T> | undefined;
|
2241
|
+
onClose?: ReactEventHandler<T> | undefined;
|
2180
2242
|
open?: boolean | undefined;
|
2181
2243
|
}
|
2182
2244
|
|
@@ -2198,7 +2260,9 @@ declare namespace React {
|
|
2198
2260
|
action?:
|
2199
2261
|
| string
|
2200
2262
|
| undefined
|
2201
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2263
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2264
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2265
|
+
];
|
2202
2266
|
autoComplete?: string | undefined;
|
2203
2267
|
encType?: string | undefined;
|
2204
2268
|
method?: string | undefined;
|
@@ -2254,42 +2318,44 @@ declare namespace React {
|
|
2254
2318
|
}
|
2255
2319
|
|
2256
2320
|
type HTMLInputTypeAttribute =
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2321
|
+
| "button"
|
2322
|
+
| "checkbox"
|
2323
|
+
| "color"
|
2324
|
+
| "date"
|
2325
|
+
| "datetime-local"
|
2326
|
+
| "email"
|
2327
|
+
| "file"
|
2328
|
+
| "hidden"
|
2329
|
+
| "image"
|
2330
|
+
| "month"
|
2331
|
+
| "number"
|
2332
|
+
| "password"
|
2333
|
+
| "radio"
|
2334
|
+
| "range"
|
2335
|
+
| "reset"
|
2336
|
+
| "search"
|
2337
|
+
| "submit"
|
2338
|
+
| "tel"
|
2339
|
+
| "text"
|
2340
|
+
| "time"
|
2341
|
+
| "url"
|
2342
|
+
| "week"
|
2279
2343
|
| (string & {});
|
2280
2344
|
|
2281
2345
|
interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
|
2282
2346
|
accept?: string | undefined;
|
2283
2347
|
alt?: string | undefined;
|
2284
2348
|
autoComplete?: string | undefined;
|
2285
|
-
capture?: boolean |
|
2349
|
+
capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
|
2286
2350
|
checked?: boolean | undefined;
|
2287
2351
|
disabled?: boolean | undefined;
|
2288
|
-
enterKeyHint?:
|
2352
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
2289
2353
|
form?: string | undefined;
|
2290
2354
|
formAction?:
|
2291
2355
|
| string
|
2292
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2356
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2357
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2358
|
+
]
|
2293
2359
|
| undefined;
|
2294
2360
|
formEncType?: string | undefined;
|
2295
2361
|
formMethod?: string | undefined;
|
@@ -2408,7 +2474,7 @@ declare namespace React {
|
|
2408
2474
|
interface OlHTMLAttributes<T> extends HTMLAttributes<T> {
|
2409
2475
|
reversed?: boolean | undefined;
|
2410
2476
|
start?: number | undefined;
|
2411
|
-
type?:
|
2477
|
+
type?: "1" | "a" | "A" | "i" | "I" | undefined;
|
2412
2478
|
}
|
2413
2479
|
|
2414
2480
|
interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> {
|
@@ -2595,8 +2661,21 @@ declare namespace React {
|
|
2595
2661
|
accentHeight?: number | string | undefined;
|
2596
2662
|
accumulate?: "none" | "sum" | undefined;
|
2597
2663
|
additive?: "replace" | "sum" | undefined;
|
2598
|
-
alignmentBaseline?:
|
2599
|
-
|
2664
|
+
alignmentBaseline?:
|
2665
|
+
| "auto"
|
2666
|
+
| "baseline"
|
2667
|
+
| "before-edge"
|
2668
|
+
| "text-before-edge"
|
2669
|
+
| "middle"
|
2670
|
+
| "central"
|
2671
|
+
| "after-edge"
|
2672
|
+
| "text-after-edge"
|
2673
|
+
| "ideographic"
|
2674
|
+
| "alphabetic"
|
2675
|
+
| "hanging"
|
2676
|
+
| "mathematical"
|
2677
|
+
| "inherit"
|
2678
|
+
| undefined;
|
2600
2679
|
allowReorder?: "no" | "yes" | undefined;
|
2601
2680
|
alphabetic?: number | string | undefined;
|
2602
2681
|
amplitude?: number | string | undefined;
|
@@ -3039,7 +3118,7 @@ declare namespace React {
|
|
3039
3118
|
view: SVGFactory;
|
3040
3119
|
}
|
3041
3120
|
|
3042
|
-
interface ReactDOM extends ReactHTML, ReactSVG {
|
3121
|
+
interface ReactDOM extends ReactHTML, ReactSVG {}
|
3043
3122
|
|
3044
3123
|
//
|
3045
3124
|
// React.PropTypes
|
@@ -3052,11 +3131,9 @@ declare namespace React {
|
|
3052
3131
|
type ValidationMap<T> = PropTypes.ValidationMap<T>;
|
3053
3132
|
|
3054
3133
|
type WeakValidationMap<T> = {
|
3055
|
-
[K in keyof T]?: null extends T[K]
|
3056
|
-
? Validator<T[K] | null | undefined>
|
3057
|
-
:
|
3058
|
-
? Validator<T[K] | null | undefined>
|
3059
|
-
: Validator<T[K]>
|
3134
|
+
[K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined>
|
3135
|
+
: undefined extends T[K] ? Validator<T[K] | null | undefined>
|
3136
|
+
: Validator<T[K]>;
|
3060
3137
|
};
|
3061
3138
|
|
3062
3139
|
interface ReactPropTypes {
|
@@ -3087,8 +3164,10 @@ declare namespace React {
|
|
3087
3164
|
*/
|
3088
3165
|
// Sync with type of `const Children`.
|
3089
3166
|
interface ReactChildren {
|
3090
|
-
map<T, C>(
|
3091
|
-
C
|
3167
|
+
map<T, C>(
|
3168
|
+
children: C | ReadonlyArray<C>,
|
3169
|
+
fn: (child: C, index: number) => T,
|
3170
|
+
): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
|
3092
3171
|
forEach<C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => void): void;
|
3093
3172
|
count(children: any): number;
|
3094
3173
|
only<C>(children: C): C extends any[] ? never : C;
|
@@ -3159,15 +3238,16 @@ type MergePropTypes<P, T> =
|
|
3159
3238
|
// Distribute over P in case it is a union type
|
3160
3239
|
P extends any
|
3161
3240
|
// If props is type any, use propTypes definitions
|
3162
|
-
? IsExactlyAny<P> extends true ? T
|
3241
|
+
? IsExactlyAny<P> extends true ? T
|
3163
3242
|
// If declared props have indexed properties, ignore inferred props entirely as keyof gets widened
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
|
3243
|
+
: string extends keyof P ? P
|
3244
|
+
// Prefer declared types which are not exactly any
|
3245
|
+
:
|
3246
|
+
& Pick<P, NotExactlyAnyPropertyKeys<P>>
|
3247
|
+
// For props which are exactly any, use the type inferred from propTypes if present
|
3248
|
+
& Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>>
|
3249
|
+
// Keep leftover props not specified in propTypes
|
3250
|
+
& Pick<P, Exclude<keyof P, keyof T>>
|
3171
3251
|
: never;
|
3172
3252
|
|
3173
3253
|
type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
|
@@ -3176,43 +3256,46 @@ type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
|
|
3176
3256
|
// Undeclared default props are augmented into the resulting allowable attributes
|
3177
3257
|
// If declared props have indexed properties, ignore default props entirely as keyof gets widened
|
3178
3258
|
// Wrap in an outer-level conditional type to allow distribution over props that are unions
|
3179
|
-
type Defaultize<P, D> = P extends any
|
3180
|
-
|
3259
|
+
type Defaultize<P, D> = P extends any ? string extends keyof P ? P
|
3260
|
+
:
|
3181
3261
|
& Pick<P, Exclude<keyof P, keyof D>>
|
3182
3262
|
& InexactPartial<Pick<P, Extract<keyof P, keyof D>>>
|
3183
3263
|
& InexactPartial<Pick<D, Exclude<keyof D, keyof P>>>
|
3184
3264
|
: never;
|
3185
3265
|
|
3186
|
-
type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D
|
3266
|
+
type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D }
|
3187
3267
|
? Defaultize<MergePropTypes<P, PropTypes.InferProps<T>>, D>
|
3188
|
-
: C extends { propTypes: infer T
|
3189
|
-
|
3190
|
-
|
3191
|
-
? Defaultize<P, D>
|
3192
|
-
: P;
|
3268
|
+
: C extends { propTypes: infer T } ? MergePropTypes<P, PropTypes.InferProps<T>>
|
3269
|
+
: C extends { defaultProps: infer D } ? Defaultize<P, D>
|
3270
|
+
: P;
|
3193
3271
|
|
3194
3272
|
declare global {
|
3195
3273
|
/**
|
3196
3274
|
* @deprecated Use `React.JSX` instead of the global `JSX` namespace.
|
3197
3275
|
*/
|
3198
3276
|
namespace JSX {
|
3199
|
-
interface Element extends React.ReactElement<any, any> {
|
3277
|
+
interface Element extends React.ReactElement<any, any> {}
|
3200
3278
|
interface ElementClass extends React.Component<any> {
|
3201
3279
|
render(): React.ReactNode;
|
3202
3280
|
}
|
3203
|
-
interface ElementAttributesProperty {
|
3204
|
-
|
3281
|
+
interface ElementAttributesProperty {
|
3282
|
+
props: {};
|
3283
|
+
}
|
3284
|
+
interface ElementChildrenAttribute {
|
3285
|
+
children: {};
|
3286
|
+
}
|
3205
3287
|
|
3206
3288
|
// We can't recurse forever because `type` can't be self-referential;
|
3207
3289
|
// let's assume it's reasonable to do a single React.lazy() around a single React.memo() / vice-versa
|
3208
|
-
type LibraryManagedAttributes<C, P> = C extends
|
3290
|
+
type LibraryManagedAttributes<C, P> = C extends
|
3291
|
+
React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
|
3209
3292
|
? T extends React.MemoExoticComponent<infer U> | React.LazyExoticComponent<infer U>
|
3210
3293
|
? ReactManagedAttributes<U, P>
|
3211
|
-
|
3294
|
+
: ReactManagedAttributes<T, P>
|
3212
3295
|
: ReactManagedAttributes<C, P>;
|
3213
3296
|
|
3214
|
-
interface IntrinsicAttributes extends React.Attributes {
|
3215
|
-
interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {
|
3297
|
+
interface IntrinsicAttributes extends React.Attributes {}
|
3298
|
+
interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {}
|
3216
3299
|
|
3217
3300
|
interface IntrinsicElements {
|
3218
3301
|
// HTML
|