@types/react 18.3.14 → 19.0.0

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/ts5.0/index.d.ts ADDED
@@ -0,0 +1,4193 @@
1
+ // NOTE: Users of the `experimental` builds of React should add a reference
2
+ // to 'react/experimental' in their project. See experimental.d.ts's top comment
3
+ // for reference and documentation on how exactly to do it.
4
+
5
+ /// <reference path="global.d.ts" />
6
+
7
+ import * as CSS from "csstype";
8
+
9
+ type NativeAnimationEvent = AnimationEvent;
10
+ type NativeClipboardEvent = ClipboardEvent;
11
+ type NativeCompositionEvent = CompositionEvent;
12
+ type NativeDragEvent = DragEvent;
13
+ type NativeFocusEvent = FocusEvent;
14
+ type NativeKeyboardEvent = KeyboardEvent;
15
+ type NativeMouseEvent = MouseEvent;
16
+ type NativeTouchEvent = TouchEvent;
17
+ type NativePointerEvent = PointerEvent;
18
+ type NativeToggleEvent = ToggleEvent;
19
+ type NativeTransitionEvent = TransitionEvent;
20
+ type NativeUIEvent = UIEvent;
21
+ type NativeWheelEvent = WheelEvent;
22
+
23
+ /**
24
+ * Used to represent DOM API's where users can either pass
25
+ * true or false as a boolean or as its equivalent strings.
26
+ */
27
+ type Booleanish = boolean | "true" | "false";
28
+
29
+ /**
30
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin MDN}
31
+ */
32
+ type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined;
33
+
34
+ declare const UNDEFINED_VOID_ONLY: unique symbol;
35
+
36
+ /**
37
+ * @internal Use `Awaited<ReactNode>` instead
38
+ */
39
+ // Helper type to enable `Awaited<ReactNode>`.
40
+ // Must be a copy of the non-thenables of `ReactNode`.
41
+ type AwaitedReactNode =
42
+ | React.ReactElement
43
+ | string
44
+ | number
45
+ | bigint
46
+ | Iterable<React.ReactNode>
47
+ | React.ReactPortal
48
+ | boolean
49
+ | null
50
+ | undefined
51
+ | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
52
+ keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES
53
+ ];
54
+
55
+ /**
56
+ * The function returned from an effect passed to {@link React.useEffect useEffect},
57
+ * which can be used to clean up the effect when the component unmounts.
58
+ *
59
+ * @see {@link https://react.dev/reference/react/useEffect React Docs}
60
+ */
61
+ type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never };
62
+ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
63
+
64
+ // eslint-disable-next-line @definitelytyped/export-just-namespace
65
+ export = React;
66
+ export as namespace React;
67
+
68
+ declare namespace React {
69
+ //
70
+ // React Elements
71
+ // ----------------------------------------------------------------------
72
+
73
+ /**
74
+ * Used to retrieve the possible components which accept a given set of props.
75
+ *
76
+ * Can be passed no type parameters to get a union of all possible components
77
+ * and tags.
78
+ *
79
+ * Is a superset of {@link ComponentType}.
80
+ *
81
+ * @template P The props to match against. If not passed, defaults to any.
82
+ * @template Tag An optional tag to match against. If not passed, attempts to match against all possible tags.
83
+ *
84
+ * @example
85
+ *
86
+ * ```tsx
87
+ * // All components and tags (img, embed etc.)
88
+ * // which accept `src`
89
+ * type SrcComponents = ElementType<{ src: any }>;
90
+ * ```
91
+ *
92
+ * @example
93
+ *
94
+ * ```tsx
95
+ * // All components
96
+ * type AllComponents = ElementType;
97
+ * ```
98
+ *
99
+ * @example
100
+ *
101
+ * ```tsx
102
+ * // All custom components which match `src`, and tags which
103
+ * // match `src`, narrowed down to just `audio` and `embed`
104
+ * type SrcComponents = ElementType<{ src: any }, 'audio' | 'embed'>;
105
+ * ```
106
+ */
107
+ type ElementType<P = any, Tag extends keyof JSX.IntrinsicElements = keyof JSX.IntrinsicElements> =
108
+ | { [K in Tag]: P extends JSX.IntrinsicElements[K] ? K : never }[Tag]
109
+ | ComponentType<P>;
110
+
111
+ /**
112
+ * Represents any user-defined component, either as a function or a class.
113
+ *
114
+ * Similar to {@link JSXElementConstructor}, but with extra properties like
115
+ * {@link FunctionComponent.defaultProps defaultProps }.
116
+ *
117
+ * @template P The props the component accepts.
118
+ *
119
+ * @see {@link ComponentClass}
120
+ * @see {@link FunctionComponent}
121
+ */
122
+ type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
123
+
124
+ /**
125
+ * Represents any user-defined component, either as a function or a class.
126
+ *
127
+ * Similar to {@link ComponentType}, but without extra properties like
128
+ * {@link FunctionComponent.defaultProps defaultProps }.
129
+ *
130
+ * @template P The props the component accepts.
131
+ */
132
+ type JSXElementConstructor<P> =
133
+ | ((
134
+ props: P,
135
+ ) => ReactElement<any, any> | null)
136
+ // constructor signature must match React.Component
137
+ | (new(props: P) => Component<any, any>);
138
+
139
+ /**
140
+ * Created by {@link createRef}, or {@link useRef} when passed `null`.
141
+ *
142
+ * @template T The type of the ref's value.
143
+ *
144
+ * @example
145
+ *
146
+ * ```tsx
147
+ * const ref = createRef<HTMLDivElement>();
148
+ *
149
+ * ref.current = document.createElement('div'); // Error
150
+ * ```
151
+ */
152
+ interface RefObject<T> {
153
+ /**
154
+ * The current value of the ref.
155
+ */
156
+ current: T;
157
+ }
158
+
159
+ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
160
+ }
161
+ /**
162
+ * A callback fired whenever the ref's value changes.
163
+ *
164
+ * @template T The type of the ref's value.
165
+ *
166
+ * @see {@link https://react.dev/reference/react-dom/components/common#ref-callback React Docs}
167
+ *
168
+ * @example
169
+ *
170
+ * ```tsx
171
+ * <div ref={(node) => console.log(node)} />
172
+ * ```
173
+ */
174
+ type RefCallback<T> = {
175
+ bivarianceHack(
176
+ instance: T | null,
177
+ ):
178
+ | void
179
+ | (() => VoidOrUndefinedOnly)
180
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[
181
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES
182
+ ];
183
+ }["bivarianceHack"];
184
+
185
+ /**
186
+ * A union type of all possible shapes for React refs.
187
+ *
188
+ * @see {@link RefCallback}
189
+ * @see {@link RefObject}
190
+ */
191
+
192
+ type Ref<T> = RefCallback<T> | RefObject<T | null> | null;
193
+ /**
194
+ * @deprecated Use `Ref` instead. String refs are no longer supported.
195
+ * If you're typing a library with support for React versions with string refs, use `RefAttributes<T>['ref']` instead.
196
+ */
197
+ type LegacyRef<T> = Ref<T>;
198
+ /**
199
+ * @deprecated Use `ComponentRef<T>` instead
200
+ *
201
+ * Retrieves the type of the 'ref' prop for a given component type or tag name.
202
+ *
203
+ * @template C The component type.
204
+ *
205
+ * @example
206
+ *
207
+ * ```tsx
208
+ * type MyComponentRef = React.ElementRef<typeof MyComponent>;
209
+ * ```
210
+ *
211
+ * @example
212
+ *
213
+ * ```tsx
214
+ * type DivRef = React.ElementRef<'div'>;
215
+ * ```
216
+ */
217
+ type ElementRef<
218
+ C extends
219
+ | ForwardRefExoticComponent<any>
220
+ | { new(props: any): Component<any> }
221
+ | ((props: any) => ReactElement | null)
222
+ | keyof JSX.IntrinsicElements,
223
+ > = ComponentRef<C>;
224
+
225
+ type ComponentState = any;
226
+
227
+ /**
228
+ * A value which uniquely identifies a node among items in an array.
229
+ *
230
+ * @see {@link https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key React Docs}
231
+ */
232
+ type Key = string | number | bigint;
233
+
234
+ /**
235
+ * @internal The props any component can receive.
236
+ * You don't have to add this type. All components automatically accept these props.
237
+ * ```tsx
238
+ * const Component = () => <div />;
239
+ * <Component key="one" />
240
+ * ```
241
+ *
242
+ * WARNING: The implementation of a component will never have access to these attributes.
243
+ * The following example would be incorrect usage because {@link Component} would never have access to `key`:
244
+ * ```tsx
245
+ * const Component = (props: React.Attributes) => props.key;
246
+ * ```
247
+ */
248
+ interface Attributes {
249
+ key?: Key | null | undefined;
250
+ }
251
+ /**
252
+ * The props any component accepting refs can receive.
253
+ * Class components, built-in browser components (e.g. `div`) and forwardRef components can receive refs and automatically accept these props.
254
+ * ```tsx
255
+ * const Component = forwardRef(() => <div />);
256
+ * <Component ref={(current) => console.log(current)} />
257
+ * ```
258
+ *
259
+ * You only need this type if you manually author the types of props that need to be compatible with legacy refs.
260
+ * ```tsx
261
+ * interface Props extends React.RefAttributes<HTMLDivElement> {}
262
+ * declare const Component: React.FunctionComponent<Props>;
263
+ * ```
264
+ *
265
+ * Otherwise it's simpler to directly use {@link Ref} since you can safely use the
266
+ * props type to describe to props that a consumer can pass to the component
267
+ * as well as describing the props the implementation of a component "sees".
268
+ * {@link RefAttributes} is generally not safe to describe both consumer and seen props.
269
+ *
270
+ * ```tsx
271
+ * interface Props extends {
272
+ * ref?: React.Ref<HTMLDivElement> | undefined;
273
+ * }
274
+ * declare const Component: React.FunctionComponent<Props>;
275
+ * ```
276
+ *
277
+ * WARNING: The implementation of a component will not have access to the same type in versions of React supporting string refs.
278
+ * The following example would be incorrect usage because {@link Component} would never have access to a `ref` with type `string`
279
+ * ```tsx
280
+ * const Component = (props: React.RefAttributes) => props.ref;
281
+ * ```
282
+ */
283
+ interface RefAttributes<T> extends Attributes {
284
+ /**
285
+ * Allows getting a ref to the component instance.
286
+ * Once the component unmounts, React will set `ref.current` to `null`
287
+ * (or call the ref with `null` if you passed a callback ref).
288
+ *
289
+ * @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}
290
+ */
291
+ ref?: Ref<T> | undefined;
292
+ }
293
+
294
+ /**
295
+ * Represents the built-in attributes available to class components.
296
+ */
297
+ interface ClassAttributes<T> extends RefAttributes<T> {
298
+ }
299
+
300
+ /**
301
+ * Represents a JSX element.
302
+ *
303
+ * Where {@link ReactNode} represents everything that can be rendered, `ReactElement`
304
+ * only represents JSX.
305
+ *
306
+ * @template P The type of the props object
307
+ * @template T The type of the component or tag
308
+ *
309
+ * @example
310
+ *
311
+ * ```tsx
312
+ * const element: ReactElement = <div />;
313
+ * ```
314
+ */
315
+ interface ReactElement<
316
+ P = unknown,
317
+ T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>,
318
+ > {
319
+ type: T;
320
+ props: P;
321
+ key: string | null;
322
+ }
323
+
324
+ /**
325
+ * @deprecated
326
+ */
327
+ interface ReactComponentElement<
328
+ T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>,
329
+ P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, "key" | "ref">>,
330
+ > extends ReactElement<P, Exclude<T, number>> {}
331
+
332
+ /**
333
+ * @deprecated Use `ReactElement<P, React.FunctionComponent<P>>`
334
+ */
335
+ interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
336
+ /**
337
+ * @deprecated Use `element.props.ref` instead.
338
+ */
339
+ ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
340
+ }
341
+
342
+ /**
343
+ * @deprecated Use `ReactElement<P, React.ComponentClass<P>>`
344
+ */
345
+ type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>;
346
+ /**
347
+ * @deprecated Use `ReactElement<P, React.ComponentClass<P>>`
348
+ */
349
+ interface ComponentElement<P, T extends Component<P, ComponentState>> extends ReactElement<P, ComponentClass<P>> {
350
+ /**
351
+ * @deprecated Use `element.props.ref` instead.
352
+ */
353
+ ref?: Ref<T> | undefined;
354
+ }
355
+
356
+ /**
357
+ * @deprecated Use {@link ComponentElement} instead.
358
+ */
359
+ type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
360
+
361
+ // string fallback for custom web-components
362
+ /**
363
+ * @deprecated Use `ReactElement<P, string>`
364
+ */
365
+ interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element>
366
+ extends ReactElement<P, string>
367
+ {
368
+ /**
369
+ * @deprecated Use `element.props.ref` instead.
370
+ */
371
+ ref: Ref<T>;
372
+ }
373
+
374
+ // ReactHTML for ReactHTMLElement
375
+ interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {}
376
+
377
+ interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> {
378
+ type: HTMLElementType;
379
+ }
380
+
381
+ // ReactSVG for ReactSVGElement
382
+ interface ReactSVGElement extends DOMElement<SVGAttributes<SVGElement>, SVGElement> {
383
+ type: SVGElementType;
384
+ }
385
+
386
+ interface ReactPortal extends ReactElement {
387
+ children: ReactNode;
388
+ }
389
+
390
+ /**
391
+ * For internal usage only.
392
+ * Different release channels declare additional types of ReactNode this particular release channel accepts.
393
+ * App or library types should never augment this interface.
394
+ */
395
+ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {}
396
+
397
+ /**
398
+ * Represents all of the things React can render.
399
+ *
400
+ * Where {@link ReactElement} only represents JSX, `ReactNode` represents everything that can be rendered.
401
+ *
402
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/reactnode/ React TypeScript Cheatsheet}
403
+ *
404
+ * @example
405
+ *
406
+ * ```tsx
407
+ * // Typing children
408
+ * type Props = { children: ReactNode }
409
+ *
410
+ * const Component = ({ children }: Props) => <div>{children}</div>
411
+ *
412
+ * <Component>hello</Component>
413
+ * ```
414
+ *
415
+ * @example
416
+ *
417
+ * ```tsx
418
+ * // Typing a custom element
419
+ * type Props = { customElement: ReactNode }
420
+ *
421
+ * const Component = ({ customElement }: Props) => <div>{customElement}</div>
422
+ *
423
+ * <Component customElement={<div>hello</div>} />
424
+ * ```
425
+ */
426
+ // non-thenables need to be kept in sync with AwaitedReactNode
427
+ type ReactNode =
428
+ | ReactElement
429
+ | string
430
+ | number
431
+ | bigint
432
+ | Iterable<ReactNode>
433
+ | ReactPortal
434
+ | boolean
435
+ | null
436
+ | undefined
437
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
438
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES
439
+ ]
440
+ | Promise<AwaitedReactNode>;
441
+
442
+ //
443
+ // Top Level API
444
+ // ----------------------------------------------------------------------
445
+
446
+ // DOM Elements
447
+ // TODO: generalize this to everything in `keyof ReactHTML`, not just "input"
448
+ function createElement(
449
+ type: "input",
450
+ props?: InputHTMLAttributes<HTMLInputElement> & ClassAttributes<HTMLInputElement> | null,
451
+ ...children: ReactNode[]
452
+ ): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
453
+ function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
454
+ type: HTMLElementType,
455
+ props?: ClassAttributes<T> & P | null,
456
+ ...children: ReactNode[]
457
+ ): DetailedReactHTMLElement<P, T>;
458
+ function createElement<P extends SVGAttributes<T>, T extends SVGElement>(
459
+ type: SVGElementType,
460
+ props?: ClassAttributes<T> & P | null,
461
+ ...children: ReactNode[]
462
+ ): ReactSVGElement;
463
+ function createElement<P extends DOMAttributes<T>, T extends Element>(
464
+ type: string,
465
+ props?: ClassAttributes<T> & P | null,
466
+ ...children: ReactNode[]
467
+ ): DOMElement<P, T>;
468
+
469
+ // Custom components
470
+
471
+ function createElement<P extends {}>(
472
+ type: FunctionComponent<P>,
473
+ props?: Attributes & P | null,
474
+ ...children: ReactNode[]
475
+ ): FunctionComponentElement<P>;
476
+ function createElement<P extends {}, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
477
+ type: ClassType<P, T, C>,
478
+ props?: ClassAttributes<T> & P | null,
479
+ ...children: ReactNode[]
480
+ ): CElement<P, T>;
481
+ function createElement<P extends {}>(
482
+ type: FunctionComponent<P> | ComponentClass<P> | string,
483
+ props?: Attributes & P | null,
484
+ ...children: ReactNode[]
485
+ ): ReactElement<P>;
486
+
487
+ // DOM Elements
488
+ // ReactHTMLElement
489
+ function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
490
+ element: DetailedReactHTMLElement<P, T>,
491
+ props?: P,
492
+ ...children: ReactNode[]
493
+ ): DetailedReactHTMLElement<P, T>;
494
+ // ReactHTMLElement, less specific
495
+ function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
496
+ element: ReactHTMLElement<T>,
497
+ props?: P,
498
+ ...children: ReactNode[]
499
+ ): ReactHTMLElement<T>;
500
+ // SVGElement
501
+ function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>(
502
+ element: ReactSVGElement,
503
+ props?: P,
504
+ ...children: ReactNode[]
505
+ ): ReactSVGElement;
506
+ // DOM Element (has to be the last, because type checking stops at first overload that fits)
507
+ function cloneElement<P extends DOMAttributes<T>, T extends Element>(
508
+ element: DOMElement<P, T>,
509
+ props?: DOMAttributes<T> & P,
510
+ ...children: ReactNode[]
511
+ ): DOMElement<P, T>;
512
+
513
+ // Custom components
514
+ function cloneElement<P>(
515
+ element: FunctionComponentElement<P>,
516
+ props?: Partial<P> & Attributes,
517
+ ...children: ReactNode[]
518
+ ): FunctionComponentElement<P>;
519
+ function cloneElement<P, T extends Component<P, ComponentState>>(
520
+ element: CElement<P, T>,
521
+ props?: Partial<P> & ClassAttributes<T>,
522
+ ...children: ReactNode[]
523
+ ): CElement<P, T>;
524
+ function cloneElement<P>(
525
+ element: ReactElement<P>,
526
+ props?: Partial<P> & Attributes,
527
+ ...children: ReactNode[]
528
+ ): ReactElement<P>;
529
+
530
+ /**
531
+ * Describes the props accepted by a Context {@link Provider}.
532
+ *
533
+ * @template T The type of the value the context provides.
534
+ */
535
+ interface ProviderProps<T> {
536
+ value: T;
537
+ children?: ReactNode | undefined;
538
+ }
539
+
540
+ /**
541
+ * Describes the props accepted by a Context {@link Consumer}.
542
+ *
543
+ * @template T The type of the value the context provides.
544
+ */
545
+ interface ConsumerProps<T> {
546
+ children: (value: T) => ReactNode;
547
+ }
548
+
549
+ /**
550
+ * An object masquerading as a component. These are created by functions
551
+ * like {@link forwardRef}, {@link memo}, and {@link createContext}.
552
+ *
553
+ * In order to make TypeScript work, we pretend that they are normal
554
+ * components.
555
+ *
556
+ * But they are, in fact, not callable - instead, they are objects which
557
+ * are treated specially by the renderer.
558
+ *
559
+ * @template P The props the component accepts.
560
+ */
561
+ interface ExoticComponent<P = {}> {
562
+ (props: P): ReactElement | null;
563
+ readonly $$typeof: symbol;
564
+ }
565
+
566
+ /**
567
+ * An {@link ExoticComponent} with a `displayName` property applied to it.
568
+ *
569
+ * @template P The props the component accepts.
570
+ */
571
+ interface NamedExoticComponent<P = {}> extends ExoticComponent<P> {
572
+ /**
573
+ * Used in debugging messages. You might want to set it
574
+ * explicitly if you want to display a different name for
575
+ * debugging purposes.
576
+ *
577
+ * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
578
+ */
579
+ displayName?: string | undefined;
580
+ }
581
+
582
+ /**
583
+ * An {@link ExoticComponent} with a `propTypes` property applied to it.
584
+ *
585
+ * @template P The props the component accepts.
586
+ */
587
+ interface ProviderExoticComponent<P> extends ExoticComponent<P> {
588
+ }
589
+
590
+ /**
591
+ * Used to retrieve the type of a context object from a {@link Context}.
592
+ *
593
+ * @template C The context object.
594
+ *
595
+ * @example
596
+ *
597
+ * ```tsx
598
+ * import { createContext } from 'react';
599
+ *
600
+ * const MyContext = createContext({ foo: 'bar' });
601
+ *
602
+ * type ContextType = ContextType<typeof MyContext>;
603
+ * // ContextType = { foo: string }
604
+ * ```
605
+ */
606
+ type ContextType<C extends Context<any>> = C extends Context<infer T> ? T : never;
607
+
608
+ /**
609
+ * Wraps your components to specify the value of this context for all components inside.
610
+ *
611
+ * @see {@link https://react.dev/reference/react/createContext#provider React Docs}
612
+ *
613
+ * @example
614
+ *
615
+ * ```tsx
616
+ * import { createContext } from 'react';
617
+ *
618
+ * const ThemeContext = createContext('light');
619
+ *
620
+ * function App() {
621
+ * return (
622
+ * <ThemeContext.Provider value="dark">
623
+ * <Toolbar />
624
+ * </ThemeContext.Provider>
625
+ * );
626
+ * }
627
+ * ```
628
+ */
629
+ type Provider<T> = ProviderExoticComponent<ProviderProps<T>>;
630
+
631
+ /**
632
+ * The old way to read context, before {@link useContext} existed.
633
+ *
634
+ * @see {@link https://react.dev/reference/react/createContext#consumer React Docs}
635
+ *
636
+ * @example
637
+ *
638
+ * ```tsx
639
+ * import { UserContext } from './user-context';
640
+ *
641
+ * function Avatar() {
642
+ * return (
643
+ * <UserContext.Consumer>
644
+ * {user => <img src={user.profileImage} alt={user.name} />}
645
+ * </UserContext.Consumer>
646
+ * );
647
+ * }
648
+ * ```
649
+ */
650
+ type Consumer<T> = ExoticComponent<ConsumerProps<T>>;
651
+
652
+ /**
653
+ * Context lets components pass information deep down without explicitly
654
+ * passing props.
655
+ *
656
+ * Created from {@link createContext}
657
+ *
658
+ * @see {@link https://react.dev/learn/passing-data-deeply-with-context React Docs}
659
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet}
660
+ *
661
+ * @example
662
+ *
663
+ * ```tsx
664
+ * import { createContext } from 'react';
665
+ *
666
+ * const ThemeContext = createContext('light');
667
+ * ```
668
+ */
669
+ interface Context<T> extends Provider<T> {
670
+ Provider: Provider<T>;
671
+ Consumer: Consumer<T>;
672
+ /**
673
+ * Used in debugging messages. You might want to set it
674
+ * explicitly if you want to display a different name for
675
+ * debugging purposes.
676
+ *
677
+ * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
678
+ */
679
+ displayName?: string | undefined;
680
+ }
681
+
682
+ /**
683
+ * Lets you create a {@link Context} that components can provide or read.
684
+ *
685
+ * @param defaultValue The value you want the context to have when there is no matching
686
+ * {@link Provider} in the tree above the component reading the context. This is meant
687
+ * as a "last resort" fallback.
688
+ *
689
+ * @see {@link https://react.dev/reference/react/createContext#reference React Docs}
690
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet}
691
+ *
692
+ * @example
693
+ *
694
+ * ```tsx
695
+ * import { createContext } from 'react';
696
+ *
697
+ * const ThemeContext = createContext('light');
698
+ * function App() {
699
+ * return (
700
+ * <ThemeContext value="dark">
701
+ * <Toolbar />
702
+ * </ThemeContext>
703
+ * );
704
+ * }
705
+ * ```
706
+ */
707
+ function createContext<T>(
708
+ // If you thought this should be optional, see
709
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24509#issuecomment-382213106
710
+ defaultValue: T,
711
+ ): Context<T>;
712
+
713
+ function isValidElement<P>(object: {} | null | undefined): object is ReactElement<P>;
714
+
715
+ const Children: {
716
+ map<T, C>(
717
+ children: C | readonly C[],
718
+ fn: (child: C, index: number) => T,
719
+ ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
720
+ forEach<C>(children: C | readonly C[], fn: (child: C, index: number) => void): void;
721
+ count(children: any): number;
722
+ only<C>(children: C): C extends any[] ? never : C;
723
+ toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>;
724
+ };
725
+ /**
726
+ * Lets you group elements without a wrapper node.
727
+ *
728
+ * @see {@link https://react.dev/reference/react/Fragment React Docs}
729
+ *
730
+ * @example
731
+ *
732
+ * ```tsx
733
+ * import { Fragment } from 'react';
734
+ *
735
+ * <Fragment>
736
+ * <td>Hello</td>
737
+ * <td>World</td>
738
+ * </Fragment>
739
+ * ```
740
+ *
741
+ * @example
742
+ *
743
+ * ```tsx
744
+ * // Using the <></> shorthand syntax:
745
+ *
746
+ * <>
747
+ * <td>Hello</td>
748
+ * <td>World</td>
749
+ * </>
750
+ * ```
751
+ */
752
+ const Fragment: ExoticComponent<{ children?: ReactNode | undefined }>;
753
+
754
+ /**
755
+ * Lets you find common bugs in your components early during development.
756
+ *
757
+ * @see {@link https://react.dev/reference/react/StrictMode React Docs}
758
+ *
759
+ * @example
760
+ *
761
+ * ```tsx
762
+ * import { StrictMode } from 'react';
763
+ *
764
+ * <StrictMode>
765
+ * <App />
766
+ * </StrictMode>
767
+ * ```
768
+ */
769
+ const StrictMode: ExoticComponent<{ children?: ReactNode | undefined }>;
770
+
771
+ /**
772
+ * The props accepted by {@link Suspense}.
773
+ *
774
+ * @see {@link https://react.dev/reference/react/Suspense React Docs}
775
+ */
776
+ interface SuspenseProps {
777
+ children?: ReactNode | undefined;
778
+
779
+ /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */
780
+ fallback?: ReactNode;
781
+
782
+ /**
783
+ * A name for this Suspense boundary for instrumentation purposes.
784
+ * The name will help identify this boundary in React DevTools.
785
+ */
786
+ name?: string | undefined;
787
+ }
788
+
789
+ /**
790
+ * Lets you display a fallback until its children have finished loading.
791
+ *
792
+ * @see {@link https://react.dev/reference/react/Suspense React Docs}
793
+ *
794
+ * @example
795
+ *
796
+ * ```tsx
797
+ * import { Suspense } from 'react';
798
+ *
799
+ * <Suspense fallback={<Loading />}>
800
+ * <ProfileDetails />
801
+ * </Suspense>
802
+ * ```
803
+ */
804
+ const Suspense: ExoticComponent<SuspenseProps>;
805
+ const version: string;
806
+
807
+ /**
808
+ * The callback passed to {@link ProfilerProps.onRender}.
809
+ *
810
+ * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
811
+ */
812
+ type ProfilerOnRenderCallback = (
813
+ /**
814
+ * The string id prop of the {@link Profiler} tree that has just committed. This lets
815
+ * you identify which part of the tree was committed if you are using multiple
816
+ * profilers.
817
+ *
818
+ * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
819
+ */
820
+ id: string,
821
+ /**
822
+ * This lets you know whether the tree has just been mounted for the first time
823
+ * or re-rendered due to a change in props, state, or hooks.
824
+ *
825
+ * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
826
+ */
827
+ phase: "mount" | "update" | "nested-update",
828
+ /**
829
+ * The number of milliseconds spent rendering the {@link Profiler} and its descendants
830
+ * for the current update. This indicates how well the subtree makes use of
831
+ * memoization (e.g. {@link memo} and {@link useMemo}). Ideally this value should decrease
832
+ * significantly after the initial mount as many of the descendants will only need to
833
+ * re-render if their specific props change.
834
+ *
835
+ * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
836
+ */
837
+ actualDuration: number,
838
+ /**
839
+ * The number of milliseconds estimating how much time it would take to re-render the entire
840
+ * {@link Profiler} subtree without any optimizations. It is calculated by summing up the most
841
+ * recent render durations of each component in the tree. This value estimates a worst-case
842
+ * cost of rendering (e.g. the initial mount or a tree with no memoization). Compare
843
+ * {@link actualDuration} against it to see if memoization is working.
844
+ *
845
+ * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
846
+ */
847
+ baseDuration: number,
848
+ /**
849
+ * A numeric timestamp for when React began rendering the current update.
850
+ *
851
+ * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
852
+ */
853
+ startTime: number,
854
+ /**
855
+ * A numeric timestamp for when React committed the current update. This value is shared
856
+ * between all profilers in a commit, enabling them to be grouped if desirable.
857
+ *
858
+ * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
859
+ */
860
+ commitTime: number,
861
+ ) => void;
862
+
863
+ /**
864
+ * The props accepted by {@link Profiler}.
865
+ *
866
+ * @see {@link https://react.dev/reference/react/Profiler React Docs}
867
+ */
868
+ interface ProfilerProps {
869
+ children?: ReactNode | undefined;
870
+ id: string;
871
+ onRender: ProfilerOnRenderCallback;
872
+ }
873
+
874
+ /**
875
+ * Lets you measure rendering performance of a React tree programmatically.
876
+ *
877
+ * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
878
+ *
879
+ * @example
880
+ *
881
+ * ```tsx
882
+ * <Profiler id="App" onRender={onRender}>
883
+ * <App />
884
+ * </Profiler>
885
+ * ```
886
+ */
887
+ const Profiler: ExoticComponent<ProfilerProps>;
888
+
889
+ //
890
+ // Component API
891
+ // ----------------------------------------------------------------------
892
+
893
+ type ReactInstance = Component<any> | Element;
894
+
895
+ // Base component for plain JS classes
896
+ interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {}
897
+ class Component<P, S> {
898
+ /**
899
+ * If set, `this.context` will be set at runtime to the current value of the given Context.
900
+ *
901
+ * @example
902
+ *
903
+ * ```ts
904
+ * type MyContext = number
905
+ * const Ctx = React.createContext<MyContext>(0)
906
+ *
907
+ * class Foo extends React.Component {
908
+ * static contextType = Ctx
909
+ * context!: React.ContextType<typeof Ctx>
910
+ * render () {
911
+ * return <>My context's value: {this.context}</>;
912
+ * }
913
+ * }
914
+ * ```
915
+ *
916
+ * @see {@link https://react.dev/reference/react/Component#static-contexttype}
917
+ */
918
+ static contextType?: Context<any> | undefined;
919
+
920
+ /**
921
+ * Ignored by React.
922
+ * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
923
+ */
924
+ static propTypes?: any;
925
+
926
+ /**
927
+ * If using the new style context, re-declare this in your class to be the
928
+ * `React.ContextType` of your `static contextType`.
929
+ * Should be used with type annotation or static contextType.
930
+ *
931
+ * @example
932
+ * ```ts
933
+ * static contextType = MyContext
934
+ * // For TS pre-3.7:
935
+ * context!: React.ContextType<typeof MyContext>
936
+ * // For TS 3.7 and above:
937
+ * declare context: React.ContextType<typeof MyContext>
938
+ * ```
939
+ *
940
+ * @see {@link https://react.dev/reference/react/Component#context React Docs}
941
+ */
942
+ context: unknown;
943
+
944
+ // Keep in sync with constructor signature of JSXElementConstructor and ComponentClass.
945
+ constructor(props: P);
946
+
947
+ // We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
948
+ // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
949
+ // Also, the ` | S` allows intellisense to not be dumbisense
950
+ setState<K extends keyof S>(
951
+ state: ((prevState: Readonly<S>, props: Readonly<P>) => Pick<S, K> | S | null) | (Pick<S, K> | S | null),
952
+ callback?: () => void,
953
+ ): void;
954
+
955
+ forceUpdate(callback?: () => void): void;
956
+ render(): ReactNode;
957
+
958
+ readonly props: Readonly<P>;
959
+ state: Readonly<S>;
960
+ }
961
+
962
+ class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {}
963
+
964
+ /**
965
+ * @deprecated Use `ClassicComponent` from `create-react-class`
966
+ *
967
+ * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs}
968
+ * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm}
969
+ */
970
+ interface ClassicComponent<P = {}, S = {}> extends Component<P, S> {
971
+ replaceState(nextState: S, callback?: () => void): void;
972
+ isMounted(): boolean;
973
+ getInitialState?(): S;
974
+ }
975
+
976
+ //
977
+ // Class Interfaces
978
+ // ----------------------------------------------------------------------
979
+
980
+ /**
981
+ * Represents the type of a function component. Can optionally
982
+ * receive a type argument that represents the props the component
983
+ * receives.
984
+ *
985
+ * @template P The props the component accepts.
986
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet}
987
+ * @alias for {@link FunctionComponent}
988
+ *
989
+ * @example
990
+ *
991
+ * ```tsx
992
+ * // With props:
993
+ * type Props = { name: string }
994
+ *
995
+ * const MyComponent: FC<Props> = (props) => {
996
+ * return <div>{props.name}</div>
997
+ * }
998
+ * ```
999
+ *
1000
+ * @example
1001
+ *
1002
+ * ```tsx
1003
+ * // Without props:
1004
+ * const MyComponentWithoutProps: FC = () => {
1005
+ * return <div>MyComponentWithoutProps</div>
1006
+ * }
1007
+ * ```
1008
+ */
1009
+ type FC<P = {}> = FunctionComponent<P>;
1010
+
1011
+ /**
1012
+ * Represents the type of a function component. Can optionally
1013
+ * receive a type argument that represents the props the component
1014
+ * accepts.
1015
+ *
1016
+ * @template P The props the component accepts.
1017
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet}
1018
+ *
1019
+ * @example
1020
+ *
1021
+ * ```tsx
1022
+ * // With props:
1023
+ * type Props = { name: string }
1024
+ *
1025
+ * const MyComponent: FunctionComponent<Props> = (props) => {
1026
+ * return <div>{props.name}</div>
1027
+ * }
1028
+ * ```
1029
+ *
1030
+ * @example
1031
+ *
1032
+ * ```tsx
1033
+ * // Without props:
1034
+ * const MyComponentWithoutProps: FunctionComponent = () => {
1035
+ * return <div>MyComponentWithoutProps</div>
1036
+ * }
1037
+ * ```
1038
+ */
1039
+ interface FunctionComponent<P = {}> {
1040
+ (props: P): ReactElement<any, any> | null;
1041
+ /**
1042
+ * Ignored by React.
1043
+ * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
1044
+ */
1045
+ propTypes?: any;
1046
+ /**
1047
+ * Used in debugging messages. You might want to set it
1048
+ * explicitly if you want to display a different name for
1049
+ * debugging purposes.
1050
+ *
1051
+ * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
1052
+ *
1053
+ * @example
1054
+ *
1055
+ * ```tsx
1056
+ *
1057
+ * const MyComponent: FC = () => {
1058
+ * return <div>Hello!</div>
1059
+ * }
1060
+ *
1061
+ * MyComponent.displayName = 'MyAwesomeComponent'
1062
+ * ```
1063
+ */
1064
+ displayName?: string | undefined;
1065
+ }
1066
+
1067
+ /**
1068
+ * The type of the ref received by a {@link ForwardRefRenderFunction}.
1069
+ *
1070
+ * @see {@link ForwardRefRenderFunction}
1071
+ */
1072
+ type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null;
1073
+
1074
+ /**
1075
+ * The type of the function passed to {@link forwardRef}. This is considered different
1076
+ * to a normal {@link FunctionComponent} because it receives an additional argument,
1077
+ *
1078
+ * @param props Props passed to the component, if any.
1079
+ * @param ref A ref forwarded to the component of type {@link ForwardedRef}.
1080
+ *
1081
+ * @template T The type of the forwarded ref.
1082
+ * @template P The type of the props the component accepts.
1083
+ *
1084
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet}
1085
+ * @see {@link forwardRef}
1086
+ */
1087
+ interface ForwardRefRenderFunction<T, P = {}> {
1088
+ (props: P, ref: ForwardedRef<T>): ReactElement | null;
1089
+ /**
1090
+ * Used in debugging messages. You might want to set it
1091
+ * explicitly if you want to display a different name for
1092
+ * debugging purposes.
1093
+ *
1094
+ * Will show `ForwardRef(${Component.displayName || Component.name})`
1095
+ * in devtools by default, but can be given its own specific name.
1096
+ *
1097
+ * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
1098
+ */
1099
+ displayName?: string | undefined;
1100
+ /**
1101
+ * Ignored by React.
1102
+ * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
1103
+ */
1104
+ propTypes?: any;
1105
+ }
1106
+
1107
+ /**
1108
+ * Represents a component class in React.
1109
+ *
1110
+ * @template P The props the component accepts.
1111
+ * @template S The internal state of the component.
1112
+ */
1113
+ interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
1114
+ // constructor signature must match React.Component
1115
+ new(props: P): Component<P, S>;
1116
+ /**
1117
+ * Ignored by React.
1118
+ * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
1119
+ */
1120
+ propTypes?: any;
1121
+ contextType?: Context<any> | undefined;
1122
+ defaultProps?: Partial<P> | undefined;
1123
+ /**
1124
+ * Used in debugging messages. You might want to set it
1125
+ * explicitly if you want to display a different name for
1126
+ * debugging purposes.
1127
+ *
1128
+ * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
1129
+ */
1130
+ displayName?: string | undefined;
1131
+ }
1132
+
1133
+ /**
1134
+ * @deprecated Use `ClassicComponentClass` from `create-react-class`
1135
+ *
1136
+ * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs}
1137
+ * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm}
1138
+ */
1139
+ interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
1140
+ new(props: P): ClassicComponent<P, ComponentState>;
1141
+ getDefaultProps?(): P;
1142
+ }
1143
+
1144
+ /**
1145
+ * Used in {@link createElement} and {@link createFactory} to represent
1146
+ * a class.
1147
+ *
1148
+ * An intersection type is used to infer multiple type parameters from
1149
+ * a single argument, which is useful for many top-level API defs.
1150
+ * See {@link https://github.com/Microsoft/TypeScript/issues/7234 this GitHub issue}
1151
+ * for more info.
1152
+ */
1153
+ type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
1154
+ & C
1155
+ & (new(props: P) => T);
1156
+
1157
+ //
1158
+ // Component Specs and Lifecycle
1159
+ // ----------------------------------------------------------------------
1160
+
1161
+ // This should actually be something like `Lifecycle<P, S> | DeprecatedLifecycle<P, S>`,
1162
+ // as React will _not_ call the deprecated lifecycle methods if any of the new lifecycle
1163
+ // methods are present.
1164
+ interface ComponentLifecycle<P, S, SS = any> extends NewLifecycle<P, S, SS>, DeprecatedLifecycle<P, S> {
1165
+ /**
1166
+ * Called immediately after a component is mounted. Setting state here will trigger re-rendering.
1167
+ */
1168
+ componentDidMount?(): void;
1169
+ /**
1170
+ * Called to determine whether the change in props and state should trigger a re-render.
1171
+ *
1172
+ * `Component` always returns true.
1173
+ * `PureComponent` implements a shallow comparison on props and state and returns true if any
1174
+ * props or states have changed.
1175
+ *
1176
+ * If false is returned, {@link Component.render}, `componentWillUpdate`
1177
+ * and `componentDidUpdate` will not be called.
1178
+ */
1179
+ shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>): boolean;
1180
+ /**
1181
+ * Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
1182
+ * cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`.
1183
+ */
1184
+ componentWillUnmount?(): void;
1185
+ /**
1186
+ * Catches exceptions generated in descendant components. Unhandled exceptions will cause
1187
+ * the entire component tree to unmount.
1188
+ */
1189
+ componentDidCatch?(error: Error, errorInfo: ErrorInfo): void;
1190
+ }
1191
+
1192
+ // Unfortunately, we have no way of declaring that the component constructor must implement this
1193
+ interface StaticLifecycle<P, S> {
1194
+ getDerivedStateFromProps?: GetDerivedStateFromProps<P, S> | undefined;
1195
+ getDerivedStateFromError?: GetDerivedStateFromError<P, S> | undefined;
1196
+ }
1197
+
1198
+ type GetDerivedStateFromProps<P, S> =
1199
+ /**
1200
+ * Returns an update to a component's state based on its new props and old state.
1201
+ *
1202
+ * Note: its presence prevents any of the deprecated lifecycle methods from being invoked
1203
+ */
1204
+ (nextProps: Readonly<P>, prevState: S) => Partial<S> | null;
1205
+
1206
+ type GetDerivedStateFromError<P, S> =
1207
+ /**
1208
+ * This lifecycle is invoked after an error has been thrown by a descendant component.
1209
+ * It receives the error that was thrown as a parameter and should return a value to update state.
1210
+ *
1211
+ * Note: its presence prevents any of the deprecated lifecycle methods from being invoked
1212
+ */
1213
+ (error: any) => Partial<S> | null;
1214
+
1215
+ // This should be "infer SS" but can't use it yet
1216
+ interface NewLifecycle<P, S, SS> {
1217
+ /**
1218
+ * Runs before React applies the result of {@link Component.render render} to the document, and
1219
+ * returns an object to be given to {@link componentDidUpdate}. Useful for saving
1220
+ * things such as scroll position before {@link Component.render render} causes changes to it.
1221
+ *
1222
+ * Note: the presence of this method prevents any of the deprecated
1223
+ * lifecycle events from running.
1224
+ */
1225
+ getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>): SS | null;
1226
+ /**
1227
+ * Called immediately after updating occurs. Not called for the initial render.
1228
+ *
1229
+ * The snapshot is only present if {@link getSnapshotBeforeUpdate} is present and returns non-null.
1230
+ */
1231
+ componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot?: SS): void;
1232
+ }
1233
+
1234
+ interface DeprecatedLifecycle<P, S> {
1235
+ /**
1236
+ * Called immediately before mounting occurs, and before {@link Component.render}.
1237
+ * Avoid introducing any side-effects or subscriptions in this method.
1238
+ *
1239
+ * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
1240
+ * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
1241
+ * this from being invoked.
1242
+ *
1243
+ * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead; will stop working in React 17
1244
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state}
1245
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1246
+ */
1247
+ componentWillMount?(): void;
1248
+ /**
1249
+ * Called immediately before mounting occurs, and before {@link Component.render}.
1250
+ * Avoid introducing any side-effects or subscriptions in this method.
1251
+ *
1252
+ * This method will not stop working in React 17.
1253
+ *
1254
+ * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
1255
+ * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
1256
+ * this from being invoked.
1257
+ *
1258
+ * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead
1259
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state}
1260
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1261
+ */
1262
+ UNSAFE_componentWillMount?(): void;
1263
+ /**
1264
+ * Called when the component may be receiving new props.
1265
+ * React may call this even if props have not changed, so be sure to compare new and existing
1266
+ * props if you only want to handle changes.
1267
+ *
1268
+ * Calling {@link Component.setState} generally does not trigger this method.
1269
+ *
1270
+ * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
1271
+ * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
1272
+ * this from being invoked.
1273
+ *
1274
+ * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead; will stop working in React 17
1275
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
1276
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1277
+ */
1278
+ componentWillReceiveProps?(nextProps: Readonly<P>): void;
1279
+ /**
1280
+ * Called when the component may be receiving new props.
1281
+ * React may call this even if props have not changed, so be sure to compare new and existing
1282
+ * props if you only want to handle changes.
1283
+ *
1284
+ * Calling {@link Component.setState} generally does not trigger this method.
1285
+ *
1286
+ * This method will not stop working in React 17.
1287
+ *
1288
+ * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
1289
+ * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
1290
+ * this from being invoked.
1291
+ *
1292
+ * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead
1293
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
1294
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1295
+ */
1296
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>): void;
1297
+ /**
1298
+ * Called immediately before rendering when new props or state is received. Not called for the initial render.
1299
+ *
1300
+ * Note: You cannot call {@link Component.setState} here.
1301
+ *
1302
+ * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
1303
+ * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
1304
+ * this from being invoked.
1305
+ *
1306
+ * @deprecated 16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17
1307
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
1308
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1309
+ */
1310
+ componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>): void;
1311
+ /**
1312
+ * Called immediately before rendering when new props or state is received. Not called for the initial render.
1313
+ *
1314
+ * Note: You cannot call {@link Component.setState} here.
1315
+ *
1316
+ * This method will not stop working in React 17.
1317
+ *
1318
+ * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
1319
+ * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
1320
+ * this from being invoked.
1321
+ *
1322
+ * @deprecated 16.3, use getSnapshotBeforeUpdate instead
1323
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
1324
+ * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
1325
+ */
1326
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>): void;
1327
+ }
1328
+
1329
+ function createRef<T>(): RefObject<T | null>;
1330
+
1331
+ /**
1332
+ * The type of the component returned from {@link forwardRef}.
1333
+ *
1334
+ * @template P The props the component accepts, if any.
1335
+ *
1336
+ * @see {@link ExoticComponent}
1337
+ */
1338
+ interface ForwardRefExoticComponent<P> extends NamedExoticComponent<P> {
1339
+ /**
1340
+ * Ignored by React.
1341
+ * @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
1342
+ */
1343
+ propTypes?: any;
1344
+ }
1345
+
1346
+ /**
1347
+ * Lets your component expose a DOM node to a parent component
1348
+ * using a ref.
1349
+ *
1350
+ * @see {@link https://react.dev/reference/react/forwardRef React Docs}
1351
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet}
1352
+ *
1353
+ * @param render See the {@link ForwardRefRenderFunction}.
1354
+ *
1355
+ * @template T The type of the DOM node.
1356
+ * @template P The props the component accepts, if any.
1357
+ *
1358
+ * @example
1359
+ *
1360
+ * ```tsx
1361
+ * interface Props {
1362
+ * children?: ReactNode;
1363
+ * type: "submit" | "button";
1364
+ * }
1365
+ *
1366
+ * export const FancyButton = forwardRef<HTMLButtonElement, Props>((props, ref) => (
1367
+ * <button ref={ref} className="MyClassName" type={props.type}>
1368
+ * {props.children}
1369
+ * </button>
1370
+ * ));
1371
+ * ```
1372
+ */
1373
+ function forwardRef<T, P = {}>(
1374
+ render: ForwardRefRenderFunction<T, PropsWithoutRef<P>>,
1375
+ ): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
1376
+
1377
+ /**
1378
+ * Omits the 'ref' attribute from the given props object.
1379
+ *
1380
+ * @template Props The props object type.
1381
+ */
1382
+ type PropsWithoutRef<Props> =
1383
+ // Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
1384
+ // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
1385
+ // https://github.com/Microsoft/TypeScript/issues/28339
1386
+ Props extends any ? ("ref" extends keyof Props ? Omit<Props, "ref"> : Props) : Props;
1387
+ /**
1388
+ * Ensures that the props do not include string ref, which cannot be forwarded
1389
+ * @deprecated Use `Props` directly. `PropsWithRef<Props>` is just an alias for `Props`
1390
+ */
1391
+ type PropsWithRef<Props> = Props;
1392
+
1393
+ type PropsWithChildren<P = unknown> = P & { children?: ReactNode | undefined };
1394
+
1395
+ /**
1396
+ * Used to retrieve the props a component accepts. Can either be passed a string,
1397
+ * indicating a DOM element (e.g. 'div', 'span', etc.) or the type of a React
1398
+ * component.
1399
+ *
1400
+ * It's usually better to use {@link ComponentPropsWithRef} or {@link ComponentPropsWithoutRef}
1401
+ * instead of this type, as they let you be explicit about whether or not to include
1402
+ * the `ref` prop.
1403
+ *
1404
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
1405
+ *
1406
+ * @example
1407
+ *
1408
+ * ```tsx
1409
+ * // Retrieves the props an 'input' element accepts
1410
+ * type InputProps = React.ComponentProps<'input'>;
1411
+ * ```
1412
+ *
1413
+ * @example
1414
+ *
1415
+ * ```tsx
1416
+ * const MyComponent = (props: { foo: number, bar: string }) => <div />;
1417
+ *
1418
+ * // Retrieves the props 'MyComponent' accepts
1419
+ * type MyComponentProps = React.ComponentProps<typeof MyComponent>;
1420
+ * ```
1421
+ */
1422
+ type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends
1423
+ JSXElementConstructor<infer Props> ? Props
1424
+ : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T]
1425
+ : {};
1426
+
1427
+ /**
1428
+ * Used to retrieve the props a component accepts with its ref. Can either be
1429
+ * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
1430
+ * type of a React component.
1431
+ *
1432
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
1433
+ *
1434
+ * @example
1435
+ *
1436
+ * ```tsx
1437
+ * // Retrieves the props an 'input' element accepts
1438
+ * type InputProps = React.ComponentPropsWithRef<'input'>;
1439
+ * ```
1440
+ *
1441
+ * @example
1442
+ *
1443
+ * ```tsx
1444
+ * const MyComponent = (props: { foo: number, bar: string }) => <div />;
1445
+ *
1446
+ * // Retrieves the props 'MyComponent' accepts
1447
+ * type MyComponentPropsWithRef = React.ComponentPropsWithRef<typeof MyComponent>;
1448
+ * ```
1449
+ */
1450
+ type ComponentPropsWithRef<T extends ElementType> = T extends JSXElementConstructor<infer Props>
1451
+ // If it's a class i.e. newable we're dealing with a class component
1452
+ ? T extends abstract new(args: any) => any ? PropsWithoutRef<Props> & RefAttributes<InstanceType<T>>
1453
+ : Props
1454
+ : ComponentProps<T>;
1455
+ /**
1456
+ * Used to retrieve the props a custom component accepts with its ref.
1457
+ *
1458
+ * Unlike {@link ComponentPropsWithRef}, this only works with custom
1459
+ * components, i.e. components you define yourself. This is to improve
1460
+ * type-checking performance.
1461
+ *
1462
+ * @example
1463
+ *
1464
+ * ```tsx
1465
+ * const MyComponent = (props: { foo: number, bar: string }) => <div />;
1466
+ *
1467
+ * // Retrieves the props 'MyComponent' accepts
1468
+ * type MyComponentPropsWithRef = React.CustomComponentPropsWithRef<typeof MyComponent>;
1469
+ * ```
1470
+ */
1471
+ type CustomComponentPropsWithRef<T extends ComponentType> = T extends JSXElementConstructor<infer Props>
1472
+ // If it's a class i.e. newable we're dealing with a class component
1473
+ ? T extends abstract new(args: any) => any ? PropsWithoutRef<Props> & RefAttributes<InstanceType<T>>
1474
+ : Props
1475
+ : never;
1476
+
1477
+ /**
1478
+ * Used to retrieve the props a component accepts without its ref. Can either be
1479
+ * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
1480
+ * type of a React component.
1481
+ *
1482
+ * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
1483
+ *
1484
+ * @example
1485
+ *
1486
+ * ```tsx
1487
+ * // Retrieves the props an 'input' element accepts
1488
+ * type InputProps = React.ComponentPropsWithoutRef<'input'>;
1489
+ * ```
1490
+ *
1491
+ * @example
1492
+ *
1493
+ * ```tsx
1494
+ * const MyComponent = (props: { foo: number, bar: string }) => <div />;
1495
+ *
1496
+ * // Retrieves the props 'MyComponent' accepts
1497
+ * type MyComponentPropsWithoutRef = React.ComponentPropsWithoutRef<typeof MyComponent>;
1498
+ * ```
1499
+ */
1500
+ type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;
1501
+
1502
+ /**
1503
+ * Retrieves the type of the 'ref' prop for a given component type or tag name.
1504
+ *
1505
+ * @template C The component type.
1506
+ *
1507
+ * @example
1508
+ *
1509
+ * ```tsx
1510
+ * type MyComponentRef = React.ElementRef<typeof MyComponent>;
1511
+ * ```
1512
+ *
1513
+ * @example
1514
+ *
1515
+ * ```tsx
1516
+ * type DivRef = React.ElementRef<'div'>;
1517
+ * ```
1518
+ */
1519
+ type ComponentRef<T extends ElementType> = ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
1520
+ : never;
1521
+
1522
+ // will show `Memo(${Component.displayName || Component.name})` in devtools by default,
1523
+ // but can be given its own specific name
1524
+ type MemoExoticComponent<T extends ComponentType<any>> = NamedExoticComponent<CustomComponentPropsWithRef<T>> & {
1525
+ readonly type: T;
1526
+ };
1527
+
1528
+ /**
1529
+ * Lets you skip re-rendering a component when its props are unchanged.
1530
+ *
1531
+ * @see {@link https://react.dev/reference/react/memo React Docs}
1532
+ *
1533
+ * @param Component The component to memoize.
1534
+ * @param propsAreEqual A function that will be used to determine if the props have changed.
1535
+ *
1536
+ * @example
1537
+ *
1538
+ * ```tsx
1539
+ * import { memo } from 'react';
1540
+ *
1541
+ * const SomeComponent = memo(function SomeComponent(props: { foo: string }) {
1542
+ * // ...
1543
+ * });
1544
+ * ```
1545
+ */
1546
+ function memo<P extends object>(
1547
+ Component: FunctionComponent<P>,
1548
+ propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean,
1549
+ ): NamedExoticComponent<P>;
1550
+ function memo<T extends ComponentType<any>>(
1551
+ Component: T,
1552
+ propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean,
1553
+ ): MemoExoticComponent<T>;
1554
+
1555
+ interface LazyExoticComponent<T extends ComponentType<any>>
1556
+ extends ExoticComponent<CustomComponentPropsWithRef<T>>
1557
+ {
1558
+ readonly _result: T;
1559
+ }
1560
+
1561
+ /**
1562
+ * Lets you defer loading a component’s code until it is rendered for the first time.
1563
+ *
1564
+ * @see {@link https://react.dev/reference/react/lazy React Docs}
1565
+ *
1566
+ * @param load A function that returns a `Promise` or another thenable (a `Promise`-like object with a
1567
+ * then method). React will not call `load` until the first time you attempt to render the returned
1568
+ * component. After React first calls load, it will wait for it to resolve, and then render the
1569
+ * resolved value’s `.default` as a React component. Both the returned `Promise` and the `Promise`’s
1570
+ * resolved value will be cached, so React will not call load more than once. If the `Promise` rejects,
1571
+ * React will throw the rejection reason for the nearest Error Boundary to handle.
1572
+ *
1573
+ * @example
1574
+ *
1575
+ * ```tsx
1576
+ * import { lazy } from 'react';
1577
+ *
1578
+ * const MarkdownPreview = lazy(() => import('./MarkdownPreview.js'));
1579
+ * ```
1580
+ */
1581
+ function lazy<T extends ComponentType<any>>(
1582
+ load: () => Promise<{ default: T }>,
1583
+ ): LazyExoticComponent<T>;
1584
+
1585
+ //
1586
+ // React Hooks
1587
+ // ----------------------------------------------------------------------
1588
+
1589
+ /**
1590
+ * The instruction passed to a {@link Dispatch} function in {@link useState}
1591
+ * to tell React what the next value of the {@link useState} should be.
1592
+ *
1593
+ * Often found wrapped in {@link Dispatch}.
1594
+ *
1595
+ * @template S The type of the state.
1596
+ *
1597
+ * @example
1598
+ *
1599
+ * ```tsx
1600
+ * // This return type correctly represents the type of
1601
+ * // `setCount` in the example below.
1602
+ * const useCustomState = (): Dispatch<SetStateAction<number>> => {
1603
+ * const [count, setCount] = useState(0);
1604
+ *
1605
+ * return setCount;
1606
+ * }
1607
+ * ```
1608
+ */
1609
+ type SetStateAction<S> = S | ((prevState: S) => S);
1610
+
1611
+ /**
1612
+ * A function that can be used to update the state of a {@link useState}
1613
+ * or {@link useReducer} hook.
1614
+ */
1615
+ type Dispatch<A> = (value: A) => void;
1616
+ /**
1617
+ * A {@link Dispatch} function can sometimes be called without any arguments.
1618
+ */
1619
+ type DispatchWithoutAction = () => void;
1620
+ // Limit the reducer to accept only 0 or 1 action arguments
1621
+ // eslint-disable-next-line @definitelytyped/no-single-element-tuple-type
1622
+ type AnyActionArg = [] | [any];
1623
+ // Get the dispatch type from the reducer arguments (captures optional action argument correctly)
1624
+ type ActionDispatch<ActionArg extends AnyActionArg> = (...args: ActionArg) => void;
1625
+ // Unlike redux, the actions _can_ be anything
1626
+ type Reducer<S, A> = (prevState: S, action: A) => S;
1627
+ // If useReducer accepts a reducer without action, dispatch may be called without any parameters.
1628
+ type ReducerWithoutAction<S> = (prevState: S) => S;
1629
+ // types used to try and prevent the compiler from reducing S
1630
+ // to a supertype common with the second argument to useReducer()
1631
+ type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
1632
+ type DependencyList = readonly unknown[];
1633
+
1634
+ // NOTE: callbacks are _only_ allowed to return either void, or a destructor.
1635
+ type EffectCallback = () => void | Destructor;
1636
+
1637
+ /**
1638
+ * @deprecated Use `RefObject` instead.
1639
+ */
1640
+ interface MutableRefObject<T> {
1641
+ current: T;
1642
+ }
1643
+
1644
+ // This will technically work if you give a Consumer<T> or Provider<T> but it's deprecated and warns
1645
+ /**
1646
+ * Accepts a context object (the value returned from `React.createContext`) and returns the current
1647
+ * context value, as given by the nearest context provider for the given context.
1648
+ *
1649
+ * @version 16.8.0
1650
+ * @see {@link https://react.dev/reference/react/useContext}
1651
+ */
1652
+ function useContext<T>(context: Context<T> /*, (not public API) observedBits?: number|boolean */): T;
1653
+ /**
1654
+ * Returns a stateful value, and a function to update it.
1655
+ *
1656
+ * @version 16.8.0
1657
+ * @see {@link https://react.dev/reference/react/useState}
1658
+ */
1659
+ function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>];
1660
+ // convenience overload when first argument is omitted
1661
+ /**
1662
+ * Returns a stateful value, and a function to update it.
1663
+ *
1664
+ * @version 16.8.0
1665
+ * @see {@link https://react.dev/reference/react/useState}
1666
+ */
1667
+ function useState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>];
1668
+ /**
1669
+ * An alternative to `useState`.
1670
+ *
1671
+ * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
1672
+ * multiple sub-values. It also lets you optimize performance for components that trigger deep
1673
+ * updates because you can pass `dispatch` down instead of callbacks.
1674
+ *
1675
+ * @version 16.8.0
1676
+ * @see {@link https://react.dev/reference/react/useReducer}
1677
+ */
1678
+ function useReducer<S, A extends AnyActionArg>(
1679
+ reducer: (prevState: S, ...args: A) => S,
1680
+ initialState: S,
1681
+ ): [S, ActionDispatch<A>];
1682
+ /**
1683
+ * An alternative to `useState`.
1684
+ *
1685
+ * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
1686
+ * multiple sub-values. It also lets you optimize performance for components that trigger deep
1687
+ * updates because you can pass `dispatch` down instead of callbacks.
1688
+ *
1689
+ * @version 16.8.0
1690
+ * @see {@link https://react.dev/reference/react/useReducer}
1691
+ */
1692
+ function useReducer<S, A extends AnyActionArg>(
1693
+ reducer: (prevState: S, ...args: A) => S,
1694
+ initialState: S,
1695
+ ): [S, ActionDispatch<A>];
1696
+ /**
1697
+ * An alternative to `useState`.
1698
+ *
1699
+ * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
1700
+ * multiple sub-values. It also lets you optimize performance for components that trigger deep
1701
+ * updates because you can pass `dispatch` down instead of callbacks.
1702
+ *
1703
+ * @version 16.8.0
1704
+ * @see {@link https://react.dev/reference/react/useReducer}
1705
+ */
1706
+ function useReducer<S, I, A extends AnyActionArg>(
1707
+ reducer: (prevState: S, ...args: A) => S,
1708
+ initialArg: I,
1709
+ init: (i: I) => S,
1710
+ ): [S, ActionDispatch<A>];
1711
+ /**
1712
+ * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
1713
+ * (`initialValue`). The returned object will persist for the full lifetime of the component.
1714
+ *
1715
+ * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
1716
+ * value around similar to how you’d use instance fields in classes.
1717
+ *
1718
+ * @version 16.8.0
1719
+ * @see {@link https://react.dev/reference/react/useRef}
1720
+ */
1721
+ function useRef<T>(initialValue: T): RefObject<T>;
1722
+ // convenience overload for refs given as a ref prop as they typically start with a null value
1723
+ /**
1724
+ * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
1725
+ * (`initialValue`). The returned object will persist for the full lifetime of the component.
1726
+ *
1727
+ * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
1728
+ * value around similar to how you’d use instance fields in classes.
1729
+ *
1730
+ * @version 16.8.0
1731
+ * @see {@link https://react.dev/reference/react/useRef}
1732
+ */
1733
+ function useRef<T>(initialValue: T | null): RefObject<T | null>;
1734
+ // convenience overload for undefined initialValue
1735
+ /**
1736
+ * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
1737
+ * (`initialValue`). The returned object will persist for the full lifetime of the component.
1738
+ *
1739
+ * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
1740
+ * value around similar to how you’d use instance fields in classes.
1741
+ *
1742
+ * @version 16.8.0
1743
+ * @see {@link https://react.dev/reference/react/useRef}
1744
+ */
1745
+ function useRef<T>(initialValue: T | undefined): RefObject<T | undefined>;
1746
+ /**
1747
+ * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations.
1748
+ * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside
1749
+ * `useLayoutEffect` will be flushed synchronously, before the browser has a chance to paint.
1750
+ *
1751
+ * Prefer the standard `useEffect` when possible to avoid blocking visual updates.
1752
+ *
1753
+ * If you’re migrating code from a class component, `useLayoutEffect` fires in the same phase as
1754
+ * `componentDidMount` and `componentDidUpdate`.
1755
+ *
1756
+ * @version 16.8.0
1757
+ * @see {@link https://react.dev/reference/react/useLayoutEffect}
1758
+ */
1759
+ function useLayoutEffect(effect: EffectCallback, deps?: DependencyList): void;
1760
+ /**
1761
+ * Accepts a function that contains imperative, possibly effectful code.
1762
+ *
1763
+ * @param effect Imperative function that can return a cleanup function
1764
+ * @param deps If present, effect will only activate if the values in the list change.
1765
+ *
1766
+ * @version 16.8.0
1767
+ * @see {@link https://react.dev/reference/react/useEffect}
1768
+ */
1769
+ function useEffect(effect: EffectCallback, deps?: DependencyList): void;
1770
+ // NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T>
1771
+ /**
1772
+ * `useImperativeHandle` customizes the instance value that is exposed to parent components when using
1773
+ * `ref`. As always, imperative code using refs should be avoided in most cases.
1774
+ *
1775
+ * `useImperativeHandle` should be used with `React.forwardRef`.
1776
+ *
1777
+ * @version 16.8.0
1778
+ * @see {@link https://react.dev/reference/react/useImperativeHandle}
1779
+ */
1780
+ function useImperativeHandle<T, R extends T>(ref: Ref<T> | undefined, init: () => R, deps?: DependencyList): void;
1781
+ // I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key
1782
+ // useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y.
1783
+ /**
1784
+ * `useCallback` will return a memoized version of the callback that only changes if one of the `inputs`
1785
+ * has changed.
1786
+ *
1787
+ * @version 16.8.0
1788
+ * @see {@link https://react.dev/reference/react/useCallback}
1789
+ */
1790
+ // A specific function type would not trigger implicit any.
1791
+ // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types.
1792
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
1793
+ function useCallback<T extends Function>(callback: T, deps: DependencyList): T;
1794
+ /**
1795
+ * `useMemo` will only recompute the memoized value when one of the `deps` has changed.
1796
+ *
1797
+ * @version 16.8.0
1798
+ * @see {@link https://react.dev/reference/react/useMemo}
1799
+ */
1800
+ // allow undefined, but don't make it optional as that is very likely a mistake
1801
+ function useMemo<T>(factory: () => T, deps: DependencyList): T;
1802
+ /**
1803
+ * `useDebugValue` can be used to display a label for custom hooks in React DevTools.
1804
+ *
1805
+ * NOTE: We don’t recommend adding debug values to every custom hook.
1806
+ * It’s most valuable for custom hooks that are part of shared libraries.
1807
+ *
1808
+ * @version 16.8.0
1809
+ * @see {@link https://react.dev/reference/react/useDebugValue}
1810
+ */
1811
+ // the name of the custom hook is itself derived from the function name at runtime:
1812
+ // it's just the function name without the "use" prefix.
1813
+ function useDebugValue<T>(value: T, format?: (value: T) => any): void;
1814
+
1815
+ export type TransitionFunction = () => VoidOrUndefinedOnly | Promise<VoidOrUndefinedOnly>;
1816
+ // strange definition to allow vscode to show documentation on the invocation
1817
+ export interface TransitionStartFunction {
1818
+ /**
1819
+ * State updates caused inside the callback are allowed to be deferred.
1820
+ *
1821
+ * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
1822
+ *
1823
+ * @param callback A function which causes state updates that can be deferred.
1824
+ */
1825
+ (callback: TransitionFunction): void;
1826
+ }
1827
+
1828
+ /**
1829
+ * Returns a deferred version of the value that may “lag behind” it.
1830
+ *
1831
+ * This is commonly used to keep the interface responsive when you have something that renders immediately
1832
+ * based on user input and something that needs to wait for a data fetch.
1833
+ *
1834
+ * A good example of this is a text input.
1835
+ *
1836
+ * @param value The value that is going to be deferred
1837
+ *
1838
+ * @see {@link https://react.dev/reference/react/useDeferredValue}
1839
+ */
1840
+ export function useDeferredValue<T>(value: T): T;
1841
+
1842
+ /**
1843
+ * Allows components to avoid undesirable loading states by waiting for content to load
1844
+ * before transitioning to the next screen. It also allows components to defer slower,
1845
+ * data fetching updates until subsequent renders so that more crucial updates can be
1846
+ * rendered immediately.
1847
+ *
1848
+ * The `useTransition` hook returns two values in an array.
1849
+ *
1850
+ * The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish.
1851
+ * The second is a function that takes a callback. We can use it to tell React which state we want to defer.
1852
+ *
1853
+ * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
1854
+ *
1855
+ * @see {@link https://react.dev/reference/react/useTransition}
1856
+ */
1857
+ export function useTransition(): [boolean, TransitionStartFunction];
1858
+
1859
+ /**
1860
+ * Similar to `useTransition` but allows uses where hooks are not available.
1861
+ *
1862
+ * @param callback A function which causes state updates that can be deferred.
1863
+ */
1864
+ export function startTransition(scope: TransitionFunction): void;
1865
+ export function startTransition(scope: TransitionFunction): void;
1866
+
1867
+ /**
1868
+ * Wrap any code rendering and triggering updates to your components into `act()` calls.
1869
+ *
1870
+ * Ensures that the behavior in your tests matches what happens in the browser
1871
+ * more closely by executing pending `useEffect`s before returning. This also
1872
+ * reduces the amount of re-renders done.
1873
+ *
1874
+ * @param callback A synchronous, void callback that will execute as a single, complete React commit.
1875
+ *
1876
+ * @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
1877
+ */
1878
+ // NOTES
1879
+ // - the order of these signatures matters - typescript will check the signatures in source order.
1880
+ // If the `() => VoidOrUndefinedOnly` signature is first, it'll erroneously match a Promise returning function for users with
1881
+ // `strictNullChecks: false`.
1882
+ // - VoidOrUndefinedOnly is there to forbid any non-void return values for users with `strictNullChecks: true`
1883
+ // While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules.
1884
+ export function act(callback: () => VoidOrUndefinedOnly): void;
1885
+ export function act<T>(callback: () => T | Promise<T>): Promise<T>;
1886
+
1887
+ export function useId(): string;
1888
+
1889
+ /**
1890
+ * @param effect Imperative function that can return a cleanup function
1891
+ * @param deps If present, effect will only activate if the values in the list change.
1892
+ *
1893
+ * @see {@link https://github.com/facebook/react/pull/21913}
1894
+ */
1895
+ export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
1896
+
1897
+ /**
1898
+ * @param subscribe
1899
+ * @param getSnapshot
1900
+ *
1901
+ * @see {@link https://github.com/reactwg/react-18/discussions/86}
1902
+ */
1903
+ // keep in sync with `useSyncExternalStore` from `use-sync-external-store`
1904
+ export function useSyncExternalStore<Snapshot>(
1905
+ subscribe: (onStoreChange: () => void) => () => void,
1906
+ getSnapshot: () => Snapshot,
1907
+ getServerSnapshot?: () => Snapshot,
1908
+ ): Snapshot;
1909
+
1910
+ export function useOptimistic<State>(
1911
+ passthrough: State,
1912
+ ): [State, (action: State | ((pendingState: State) => State)) => void];
1913
+ export function useOptimistic<State, Action>(
1914
+ passthrough: State,
1915
+ reducer: (state: State, action: Action) => State,
1916
+ ): [State, (action: Action) => void];
1917
+
1918
+ export type Usable<T> = PromiseLike<T> | Context<T>;
1919
+
1920
+ export function use<T>(usable: Usable<T>): T;
1921
+
1922
+ export function useActionState<State>(
1923
+ action: (state: Awaited<State>) => State | Promise<State>,
1924
+ initialState: Awaited<State>,
1925
+ permalink?: string,
1926
+ ): [state: Awaited<State>, dispatch: () => void, isPending: boolean];
1927
+ export function useActionState<State, Payload>(
1928
+ action: (state: Awaited<State>, payload: Payload) => State | Promise<State>,
1929
+ initialState: Awaited<State>,
1930
+ permalink?: string,
1931
+ ): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean];
1932
+
1933
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
1934
+ export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
1935
+
1936
+ //
1937
+ // Event System
1938
+ // ----------------------------------------------------------------------
1939
+ // TODO: change any to unknown when moving to TS v3
1940
+ interface BaseSyntheticEvent<E = object, C = any, T = any> {
1941
+ nativeEvent: E;
1942
+ currentTarget: C;
1943
+ target: T;
1944
+ bubbles: boolean;
1945
+ cancelable: boolean;
1946
+ defaultPrevented: boolean;
1947
+ eventPhase: number;
1948
+ isTrusted: boolean;
1949
+ preventDefault(): void;
1950
+ isDefaultPrevented(): boolean;
1951
+ stopPropagation(): void;
1952
+ isPropagationStopped(): boolean;
1953
+ persist(): void;
1954
+ timeStamp: number;
1955
+ type: string;
1956
+ }
1957
+
1958
+ /**
1959
+ * currentTarget - a reference to the element on which the event listener is registered.
1960
+ *
1961
+ * target - a reference to the element from which the event was originally dispatched.
1962
+ * This might be a child element to the element on which the event listener is registered.
1963
+ * If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682
1964
+ */
1965
+ interface SyntheticEvent<T = Element, E = Event> extends BaseSyntheticEvent<E, EventTarget & T, EventTarget> {}
1966
+
1967
+ interface ClipboardEvent<T = Element> extends SyntheticEvent<T, NativeClipboardEvent> {
1968
+ clipboardData: DataTransfer;
1969
+ }
1970
+
1971
+ interface CompositionEvent<T = Element> extends SyntheticEvent<T, NativeCompositionEvent> {
1972
+ data: string;
1973
+ }
1974
+
1975
+ interface DragEvent<T = Element> extends MouseEvent<T, NativeDragEvent> {
1976
+ dataTransfer: DataTransfer;
1977
+ }
1978
+
1979
+ interface PointerEvent<T = Element> extends MouseEvent<T, NativePointerEvent> {
1980
+ pointerId: number;
1981
+ pressure: number;
1982
+ tangentialPressure: number;
1983
+ tiltX: number;
1984
+ tiltY: number;
1985
+ twist: number;
1986
+ width: number;
1987
+ height: number;
1988
+ pointerType: "mouse" | "pen" | "touch";
1989
+ isPrimary: boolean;
1990
+ }
1991
+
1992
+ interface FocusEvent<Target = Element, RelatedTarget = Element> extends SyntheticEvent<Target, NativeFocusEvent> {
1993
+ relatedTarget: (EventTarget & RelatedTarget) | null;
1994
+ target: EventTarget & Target;
1995
+ }
1996
+
1997
+ interface FormEvent<T = Element> extends SyntheticEvent<T> {
1998
+ }
1999
+
2000
+ interface InvalidEvent<T = Element> extends SyntheticEvent<T> {
2001
+ target: EventTarget & T;
2002
+ }
2003
+
2004
+ interface ChangeEvent<T = Element> extends SyntheticEvent<T> {
2005
+ target: EventTarget & T;
2006
+ }
2007
+
2008
+ export type ModifierKey =
2009
+ | "Alt"
2010
+ | "AltGraph"
2011
+ | "CapsLock"
2012
+ | "Control"
2013
+ | "Fn"
2014
+ | "FnLock"
2015
+ | "Hyper"
2016
+ | "Meta"
2017
+ | "NumLock"
2018
+ | "ScrollLock"
2019
+ | "Shift"
2020
+ | "Super"
2021
+ | "Symbol"
2022
+ | "SymbolLock";
2023
+
2024
+ interface KeyboardEvent<T = Element> extends UIEvent<T, NativeKeyboardEvent> {
2025
+ altKey: boolean;
2026
+ /** @deprecated */
2027
+ charCode: number;
2028
+ ctrlKey: boolean;
2029
+ code: string;
2030
+ /**
2031
+ * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method.
2032
+ */
2033
+ getModifierState(key: ModifierKey): boolean;
2034
+ /**
2035
+ * See the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values). for possible values
2036
+ */
2037
+ key: string;
2038
+ /** @deprecated */
2039
+ keyCode: number;
2040
+ locale: string;
2041
+ location: number;
2042
+ metaKey: boolean;
2043
+ repeat: boolean;
2044
+ shiftKey: boolean;
2045
+ /** @deprecated */
2046
+ which: number;
2047
+ }
2048
+
2049
+ interface MouseEvent<T = Element, E = NativeMouseEvent> extends UIEvent<T, E> {
2050
+ altKey: boolean;
2051
+ button: number;
2052
+ buttons: number;
2053
+ clientX: number;
2054
+ clientY: number;
2055
+ ctrlKey: boolean;
2056
+ /**
2057
+ * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method.
2058
+ */
2059
+ getModifierState(key: ModifierKey): boolean;
2060
+ metaKey: boolean;
2061
+ movementX: number;
2062
+ movementY: number;
2063
+ pageX: number;
2064
+ pageY: number;
2065
+ relatedTarget: EventTarget | null;
2066
+ screenX: number;
2067
+ screenY: number;
2068
+ shiftKey: boolean;
2069
+ }
2070
+
2071
+ interface TouchEvent<T = Element> extends UIEvent<T, NativeTouchEvent> {
2072
+ altKey: boolean;
2073
+ changedTouches: TouchList;
2074
+ ctrlKey: boolean;
2075
+ /**
2076
+ * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method.
2077
+ */
2078
+ getModifierState(key: ModifierKey): boolean;
2079
+ metaKey: boolean;
2080
+ shiftKey: boolean;
2081
+ targetTouches: TouchList;
2082
+ touches: TouchList;
2083
+ }
2084
+
2085
+ interface UIEvent<T = Element, E = NativeUIEvent> extends SyntheticEvent<T, E> {
2086
+ detail: number;
2087
+ view: AbstractView;
2088
+ }
2089
+
2090
+ interface WheelEvent<T = Element> extends MouseEvent<T, NativeWheelEvent> {
2091
+ deltaMode: number;
2092
+ deltaX: number;
2093
+ deltaY: number;
2094
+ deltaZ: number;
2095
+ }
2096
+
2097
+ interface AnimationEvent<T = Element> extends SyntheticEvent<T, NativeAnimationEvent> {
2098
+ animationName: string;
2099
+ elapsedTime: number;
2100
+ pseudoElement: string;
2101
+ }
2102
+
2103
+ interface ToggleEvent<T = Element> extends SyntheticEvent<T, NativeToggleEvent> {
2104
+ oldState: "closed" | "open";
2105
+ newState: "closed" | "open";
2106
+ }
2107
+
2108
+ interface TransitionEvent<T = Element> extends SyntheticEvent<T, NativeTransitionEvent> {
2109
+ elapsedTime: number;
2110
+ propertyName: string;
2111
+ pseudoElement: string;
2112
+ }
2113
+
2114
+ //
2115
+ // Event Handler Types
2116
+ // ----------------------------------------------------------------------
2117
+
2118
+ type EventHandler<E extends SyntheticEvent<any>> = { bivarianceHack(event: E): void }["bivarianceHack"];
2119
+
2120
+ type ReactEventHandler<T = Element> = EventHandler<SyntheticEvent<T>>;
2121
+
2122
+ type ClipboardEventHandler<T = Element> = EventHandler<ClipboardEvent<T>>;
2123
+ type CompositionEventHandler<T = Element> = EventHandler<CompositionEvent<T>>;
2124
+ type DragEventHandler<T = Element> = EventHandler<DragEvent<T>>;
2125
+ type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
2126
+ type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
2127
+ type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
2128
+ type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
2129
+ type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
2130
+ type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
2131
+ type PointerEventHandler<T = Element> = EventHandler<PointerEvent<T>>;
2132
+ type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>;
2133
+ type WheelEventHandler<T = Element> = EventHandler<WheelEvent<T>>;
2134
+ type AnimationEventHandler<T = Element> = EventHandler<AnimationEvent<T>>;
2135
+ type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>;
2136
+ type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent<T>>;
2137
+
2138
+ //
2139
+ // Props / DOM Attributes
2140
+ // ----------------------------------------------------------------------
2141
+
2142
+ interface HTMLProps<T> extends AllHTMLAttributes<T>, ClassAttributes<T> {
2143
+ }
2144
+
2145
+ type DetailedHTMLProps<E extends HTMLAttributes<T>, T> = ClassAttributes<T> & E;
2146
+
2147
+ interface SVGProps<T> extends SVGAttributes<T>, ClassAttributes<T> {
2148
+ }
2149
+
2150
+ interface SVGLineElementAttributes<T> extends SVGProps<T> {}
2151
+ interface SVGTextElementAttributes<T> extends SVGProps<T> {}
2152
+
2153
+ interface DOMAttributes<T> {
2154
+ children?: ReactNode | undefined;
2155
+ dangerouslySetInnerHTML?: {
2156
+ // Should be InnerHTML['innerHTML'].
2157
+ // But unfortunately we're mixing renderer-specific type declarations.
2158
+ __html: string | TrustedHTML;
2159
+ } | undefined;
2160
+
2161
+ // Clipboard Events
2162
+ onCopy?: ClipboardEventHandler<T> | undefined;
2163
+ onCopyCapture?: ClipboardEventHandler<T> | undefined;
2164
+ onCut?: ClipboardEventHandler<T> | undefined;
2165
+ onCutCapture?: ClipboardEventHandler<T> | undefined;
2166
+ onPaste?: ClipboardEventHandler<T> | undefined;
2167
+ onPasteCapture?: ClipboardEventHandler<T> | undefined;
2168
+
2169
+ // Composition Events
2170
+ onCompositionEnd?: CompositionEventHandler<T> | undefined;
2171
+ onCompositionEndCapture?: CompositionEventHandler<T> | undefined;
2172
+ onCompositionStart?: CompositionEventHandler<T> | undefined;
2173
+ onCompositionStartCapture?: CompositionEventHandler<T> | undefined;
2174
+ onCompositionUpdate?: CompositionEventHandler<T> | undefined;
2175
+ onCompositionUpdateCapture?: CompositionEventHandler<T> | undefined;
2176
+
2177
+ // Focus Events
2178
+ onFocus?: FocusEventHandler<T> | undefined;
2179
+ onFocusCapture?: FocusEventHandler<T> | undefined;
2180
+ onBlur?: FocusEventHandler<T> | undefined;
2181
+ onBlurCapture?: FocusEventHandler<T> | undefined;
2182
+
2183
+ // Form Events
2184
+ onChange?: FormEventHandler<T> | undefined;
2185
+ onChangeCapture?: FormEventHandler<T> | undefined;
2186
+ onBeforeInput?: FormEventHandler<T> | undefined;
2187
+ onBeforeInputCapture?: FormEventHandler<T> | undefined;
2188
+ onInput?: FormEventHandler<T> | undefined;
2189
+ onInputCapture?: FormEventHandler<T> | undefined;
2190
+ onReset?: FormEventHandler<T> | undefined;
2191
+ onResetCapture?: FormEventHandler<T> | undefined;
2192
+ onSubmit?: FormEventHandler<T> | undefined;
2193
+ onSubmitCapture?: FormEventHandler<T> | undefined;
2194
+ onInvalid?: FormEventHandler<T> | undefined;
2195
+ onInvalidCapture?: FormEventHandler<T> | undefined;
2196
+
2197
+ // Image Events
2198
+ onLoad?: ReactEventHandler<T> | undefined;
2199
+ onLoadCapture?: ReactEventHandler<T> | undefined;
2200
+ onError?: ReactEventHandler<T> | undefined; // also a Media Event
2201
+ onErrorCapture?: ReactEventHandler<T> | undefined; // also a Media Event
2202
+
2203
+ // Keyboard Events
2204
+ onKeyDown?: KeyboardEventHandler<T> | undefined;
2205
+ onKeyDownCapture?: KeyboardEventHandler<T> | undefined;
2206
+ /** @deprecated Use `onKeyUp` or `onKeyDown` instead */
2207
+ onKeyPress?: KeyboardEventHandler<T> | undefined;
2208
+ /** @deprecated Use `onKeyUpCapture` or `onKeyDownCapture` instead */
2209
+ onKeyPressCapture?: KeyboardEventHandler<T> | undefined;
2210
+ onKeyUp?: KeyboardEventHandler<T> | undefined;
2211
+ onKeyUpCapture?: KeyboardEventHandler<T> | undefined;
2212
+
2213
+ // Media Events
2214
+ onAbort?: ReactEventHandler<T> | undefined;
2215
+ onAbortCapture?: ReactEventHandler<T> | undefined;
2216
+ onCanPlay?: ReactEventHandler<T> | undefined;
2217
+ onCanPlayCapture?: ReactEventHandler<T> | undefined;
2218
+ onCanPlayThrough?: ReactEventHandler<T> | undefined;
2219
+ onCanPlayThroughCapture?: ReactEventHandler<T> | undefined;
2220
+ onDurationChange?: ReactEventHandler<T> | undefined;
2221
+ onDurationChangeCapture?: ReactEventHandler<T> | undefined;
2222
+ onEmptied?: ReactEventHandler<T> | undefined;
2223
+ onEmptiedCapture?: ReactEventHandler<T> | undefined;
2224
+ onEncrypted?: ReactEventHandler<T> | undefined;
2225
+ onEncryptedCapture?: ReactEventHandler<T> | undefined;
2226
+ onEnded?: ReactEventHandler<T> | undefined;
2227
+ onEndedCapture?: ReactEventHandler<T> | undefined;
2228
+ onLoadedData?: ReactEventHandler<T> | undefined;
2229
+ onLoadedDataCapture?: ReactEventHandler<T> | undefined;
2230
+ onLoadedMetadata?: ReactEventHandler<T> | undefined;
2231
+ onLoadedMetadataCapture?: ReactEventHandler<T> | undefined;
2232
+ onLoadStart?: ReactEventHandler<T> | undefined;
2233
+ onLoadStartCapture?: ReactEventHandler<T> | undefined;
2234
+ onPause?: ReactEventHandler<T> | undefined;
2235
+ onPauseCapture?: ReactEventHandler<T> | undefined;
2236
+ onPlay?: ReactEventHandler<T> | undefined;
2237
+ onPlayCapture?: ReactEventHandler<T> | undefined;
2238
+ onPlaying?: ReactEventHandler<T> | undefined;
2239
+ onPlayingCapture?: ReactEventHandler<T> | undefined;
2240
+ onProgress?: ReactEventHandler<T> | undefined;
2241
+ onProgressCapture?: ReactEventHandler<T> | undefined;
2242
+ onRateChange?: ReactEventHandler<T> | undefined;
2243
+ onRateChangeCapture?: ReactEventHandler<T> | undefined;
2244
+ onResize?: ReactEventHandler<T> | undefined;
2245
+ onResizeCapture?: ReactEventHandler<T> | undefined;
2246
+ onSeeked?: ReactEventHandler<T> | undefined;
2247
+ onSeekedCapture?: ReactEventHandler<T> | undefined;
2248
+ onSeeking?: ReactEventHandler<T> | undefined;
2249
+ onSeekingCapture?: ReactEventHandler<T> | undefined;
2250
+ onStalled?: ReactEventHandler<T> | undefined;
2251
+ onStalledCapture?: ReactEventHandler<T> | undefined;
2252
+ onSuspend?: ReactEventHandler<T> | undefined;
2253
+ onSuspendCapture?: ReactEventHandler<T> | undefined;
2254
+ onTimeUpdate?: ReactEventHandler<T> | undefined;
2255
+ onTimeUpdateCapture?: ReactEventHandler<T> | undefined;
2256
+ onVolumeChange?: ReactEventHandler<T> | undefined;
2257
+ onVolumeChangeCapture?: ReactEventHandler<T> | undefined;
2258
+ onWaiting?: ReactEventHandler<T> | undefined;
2259
+ onWaitingCapture?: ReactEventHandler<T> | undefined;
2260
+
2261
+ // MouseEvents
2262
+ onAuxClick?: MouseEventHandler<T> | undefined;
2263
+ onAuxClickCapture?: MouseEventHandler<T> | undefined;
2264
+ onClick?: MouseEventHandler<T> | undefined;
2265
+ onClickCapture?: MouseEventHandler<T> | undefined;
2266
+ onContextMenu?: MouseEventHandler<T> | undefined;
2267
+ onContextMenuCapture?: MouseEventHandler<T> | undefined;
2268
+ onDoubleClick?: MouseEventHandler<T> | undefined;
2269
+ onDoubleClickCapture?: MouseEventHandler<T> | undefined;
2270
+ onDrag?: DragEventHandler<T> | undefined;
2271
+ onDragCapture?: DragEventHandler<T> | undefined;
2272
+ onDragEnd?: DragEventHandler<T> | undefined;
2273
+ onDragEndCapture?: DragEventHandler<T> | undefined;
2274
+ onDragEnter?: DragEventHandler<T> | undefined;
2275
+ onDragEnterCapture?: DragEventHandler<T> | undefined;
2276
+ onDragExit?: DragEventHandler<T> | undefined;
2277
+ onDragExitCapture?: DragEventHandler<T> | undefined;
2278
+ onDragLeave?: DragEventHandler<T> | undefined;
2279
+ onDragLeaveCapture?: DragEventHandler<T> | undefined;
2280
+ onDragOver?: DragEventHandler<T> | undefined;
2281
+ onDragOverCapture?: DragEventHandler<T> | undefined;
2282
+ onDragStart?: DragEventHandler<T> | undefined;
2283
+ onDragStartCapture?: DragEventHandler<T> | undefined;
2284
+ onDrop?: DragEventHandler<T> | undefined;
2285
+ onDropCapture?: DragEventHandler<T> | undefined;
2286
+ onMouseDown?: MouseEventHandler<T> | undefined;
2287
+ onMouseDownCapture?: MouseEventHandler<T> | undefined;
2288
+ onMouseEnter?: MouseEventHandler<T> | undefined;
2289
+ onMouseLeave?: MouseEventHandler<T> | undefined;
2290
+ onMouseMove?: MouseEventHandler<T> | undefined;
2291
+ onMouseMoveCapture?: MouseEventHandler<T> | undefined;
2292
+ onMouseOut?: MouseEventHandler<T> | undefined;
2293
+ onMouseOutCapture?: MouseEventHandler<T> | undefined;
2294
+ onMouseOver?: MouseEventHandler<T> | undefined;
2295
+ onMouseOverCapture?: MouseEventHandler<T> | undefined;
2296
+ onMouseUp?: MouseEventHandler<T> | undefined;
2297
+ onMouseUpCapture?: MouseEventHandler<T> | undefined;
2298
+
2299
+ // Selection Events
2300
+ onSelect?: ReactEventHandler<T> | undefined;
2301
+ onSelectCapture?: ReactEventHandler<T> | undefined;
2302
+
2303
+ // Touch Events
2304
+ onTouchCancel?: TouchEventHandler<T> | undefined;
2305
+ onTouchCancelCapture?: TouchEventHandler<T> | undefined;
2306
+ onTouchEnd?: TouchEventHandler<T> | undefined;
2307
+ onTouchEndCapture?: TouchEventHandler<T> | undefined;
2308
+ onTouchMove?: TouchEventHandler<T> | undefined;
2309
+ onTouchMoveCapture?: TouchEventHandler<T> | undefined;
2310
+ onTouchStart?: TouchEventHandler<T> | undefined;
2311
+ onTouchStartCapture?: TouchEventHandler<T> | undefined;
2312
+
2313
+ // Pointer Events
2314
+ onPointerDown?: PointerEventHandler<T> | undefined;
2315
+ onPointerDownCapture?: PointerEventHandler<T> | undefined;
2316
+ onPointerMove?: PointerEventHandler<T> | undefined;
2317
+ onPointerMoveCapture?: PointerEventHandler<T> | undefined;
2318
+ onPointerUp?: PointerEventHandler<T> | undefined;
2319
+ onPointerUpCapture?: PointerEventHandler<T> | undefined;
2320
+ onPointerCancel?: PointerEventHandler<T> | undefined;
2321
+ onPointerCancelCapture?: PointerEventHandler<T> | undefined;
2322
+ onPointerEnter?: PointerEventHandler<T> | undefined;
2323
+ onPointerLeave?: PointerEventHandler<T> | undefined;
2324
+ onPointerOver?: PointerEventHandler<T> | undefined;
2325
+ onPointerOverCapture?: PointerEventHandler<T> | undefined;
2326
+ onPointerOut?: PointerEventHandler<T> | undefined;
2327
+ onPointerOutCapture?: PointerEventHandler<T> | undefined;
2328
+ onGotPointerCapture?: PointerEventHandler<T> | undefined;
2329
+ onGotPointerCaptureCapture?: PointerEventHandler<T> | undefined;
2330
+ onLostPointerCapture?: PointerEventHandler<T> | undefined;
2331
+ onLostPointerCaptureCapture?: PointerEventHandler<T> | undefined;
2332
+
2333
+ // UI Events
2334
+ onScroll?: UIEventHandler<T> | undefined;
2335
+ onScrollCapture?: UIEventHandler<T> | undefined;
2336
+
2337
+ // Wheel Events
2338
+ onWheel?: WheelEventHandler<T> | undefined;
2339
+ onWheelCapture?: WheelEventHandler<T> | undefined;
2340
+
2341
+ // Animation Events
2342
+ onAnimationStart?: AnimationEventHandler<T> | undefined;
2343
+ onAnimationStartCapture?: AnimationEventHandler<T> | undefined;
2344
+ onAnimationEnd?: AnimationEventHandler<T> | undefined;
2345
+ onAnimationEndCapture?: AnimationEventHandler<T> | undefined;
2346
+ onAnimationIteration?: AnimationEventHandler<T> | undefined;
2347
+ onAnimationIterationCapture?: AnimationEventHandler<T> | undefined;
2348
+
2349
+ // Toggle Events
2350
+ onToggle?: ToggleEventHandler<T> | undefined;
2351
+ onBeforeToggle?: ToggleEventHandler<T> | undefined;
2352
+
2353
+ // Transition Events
2354
+ onTransitionCancel?: TransitionEventHandler<T> | undefined;
2355
+ onTransitionCancelCapture?: TransitionEventHandler<T> | undefined;
2356
+ onTransitionEnd?: TransitionEventHandler<T> | undefined;
2357
+ onTransitionEndCapture?: TransitionEventHandler<T> | undefined;
2358
+ onTransitionRun?: TransitionEventHandler<T> | undefined;
2359
+ onTransitionRunCapture?: TransitionEventHandler<T> | undefined;
2360
+ onTransitionStart?: TransitionEventHandler<T> | undefined;
2361
+ onTransitionStartCapture?: TransitionEventHandler<T> | undefined;
2362
+ }
2363
+
2364
+ export interface CSSProperties extends CSS.Properties<string | number> {
2365
+ /**
2366
+ * The index signature was removed to enable closed typing for style
2367
+ * using CSSType. You're able to use type assertion or module augmentation
2368
+ * to add properties or an index signature of your own.
2369
+ *
2370
+ * For examples and more information, visit:
2371
+ * https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors
2372
+ */
2373
+ }
2374
+
2375
+ // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/
2376
+ interface AriaAttributes {
2377
+ /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */
2378
+ "aria-activedescendant"?: string | undefined;
2379
+ /** 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. */
2380
+ "aria-atomic"?: Booleanish | undefined;
2381
+ /**
2382
+ * 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
2383
+ * presented if they are made.
2384
+ */
2385
+ "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
2386
+ /** 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. */
2387
+ /**
2388
+ * Defines a string value that labels the current element, which is intended to be converted into Braille.
2389
+ * @see aria-label.
2390
+ */
2391
+ "aria-braillelabel"?: string | undefined;
2392
+ /**
2393
+ * Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.
2394
+ * @see aria-roledescription.
2395
+ */
2396
+ "aria-brailleroledescription"?: string | undefined;
2397
+ "aria-busy"?: Booleanish | undefined;
2398
+ /**
2399
+ * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
2400
+ * @see aria-pressed @see aria-selected.
2401
+ */
2402
+ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
2403
+ /**
2404
+ * Defines the total number of columns in a table, grid, or treegrid.
2405
+ * @see aria-colindex.
2406
+ */
2407
+ "aria-colcount"?: number | undefined;
2408
+ /**
2409
+ * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
2410
+ * @see aria-colcount @see aria-colspan.
2411
+ */
2412
+ "aria-colindex"?: number | undefined;
2413
+ /**
2414
+ * Defines a human readable text alternative of aria-colindex.
2415
+ * @see aria-rowindextext.
2416
+ */
2417
+ "aria-colindextext"?: string | undefined;
2418
+ /**
2419
+ * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
2420
+ * @see aria-colindex @see aria-rowspan.
2421
+ */
2422
+ "aria-colspan"?: number | undefined;
2423
+ /**
2424
+ * Identifies the element (or elements) whose contents or presence are controlled by the current element.
2425
+ * @see aria-owns.
2426
+ */
2427
+ "aria-controls"?: string | undefined;
2428
+ /** Indicates the element that represents the current item within a container or set of related elements. */
2429
+ "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
2430
+ /**
2431
+ * Identifies the element (or elements) that describes the object.
2432
+ * @see aria-labelledby
2433
+ */
2434
+ "aria-describedby"?: string | undefined;
2435
+ /**
2436
+ * Defines a string value that describes or annotates the current element.
2437
+ * @see related aria-describedby.
2438
+ */
2439
+ "aria-description"?: string | undefined;
2440
+ /**
2441
+ * Identifies the element that provides a detailed, extended description for the object.
2442
+ * @see aria-describedby.
2443
+ */
2444
+ "aria-details"?: string | undefined;
2445
+ /**
2446
+ * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
2447
+ * @see aria-hidden @see aria-readonly.
2448
+ */
2449
+ "aria-disabled"?: Booleanish | undefined;
2450
+ /**
2451
+ * Indicates what functions can be performed when a dragged object is released on the drop target.
2452
+ * @deprecated in ARIA 1.1
2453
+ */
2454
+ "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
2455
+ /**
2456
+ * Identifies the element that provides an error message for the object.
2457
+ * @see aria-invalid @see aria-describedby.
2458
+ */
2459
+ "aria-errormessage"?: string | undefined;
2460
+ /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */
2461
+ "aria-expanded"?: Booleanish | undefined;
2462
+ /**
2463
+ * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,
2464
+ * allows assistive technology to override the general default of reading in document source order.
2465
+ */
2466
+ "aria-flowto"?: string | undefined;
2467
+ /**
2468
+ * Indicates an element's "grabbed" state in a drag-and-drop operation.
2469
+ * @deprecated in ARIA 1.1
2470
+ */
2471
+ "aria-grabbed"?: Booleanish | undefined;
2472
+ /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */
2473
+ "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
2474
+ /**
2475
+ * Indicates whether the element is exposed to an accessibility API.
2476
+ * @see aria-disabled.
2477
+ */
2478
+ "aria-hidden"?: Booleanish | undefined;
2479
+ /**
2480
+ * Indicates the entered value does not conform to the format expected by the application.
2481
+ * @see aria-errormessage.
2482
+ */
2483
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
2484
+ /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */
2485
+ "aria-keyshortcuts"?: string | undefined;
2486
+ /**
2487
+ * Defines a string value that labels the current element.
2488
+ * @see aria-labelledby.
2489
+ */
2490
+ "aria-label"?: string | undefined;
2491
+ /**
2492
+ * Identifies the element (or elements) that labels the current element.
2493
+ * @see aria-describedby.
2494
+ */
2495
+ "aria-labelledby"?: string | undefined;
2496
+ /** Defines the hierarchical level of an element within a structure. */
2497
+ "aria-level"?: number | undefined;
2498
+ /** 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. */
2499
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
2500
+ /** Indicates whether an element is modal when displayed. */
2501
+ "aria-modal"?: Booleanish | undefined;
2502
+ /** Indicates whether a text box accepts multiple lines of input or only a single line. */
2503
+ "aria-multiline"?: Booleanish | undefined;
2504
+ /** Indicates that the user may select more than one item from the current selectable descendants. */
2505
+ "aria-multiselectable"?: Booleanish | undefined;
2506
+ /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */
2507
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
2508
+ /**
2509
+ * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship
2510
+ * between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
2511
+ * @see aria-controls.
2512
+ */
2513
+ "aria-owns"?: string | undefined;
2514
+ /**
2515
+ * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.
2516
+ * A hint could be a sample value or a brief description of the expected format.
2517
+ */
2518
+ "aria-placeholder"?: string | undefined;
2519
+ /**
2520
+ * 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.
2521
+ * @see aria-setsize.
2522
+ */
2523
+ "aria-posinset"?: number | undefined;
2524
+ /**
2525
+ * Indicates the current "pressed" state of toggle buttons.
2526
+ * @see aria-checked @see aria-selected.
2527
+ */
2528
+ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
2529
+ /**
2530
+ * Indicates that the element is not editable, but is otherwise operable.
2531
+ * @see aria-disabled.
2532
+ */
2533
+ "aria-readonly"?: Booleanish | undefined;
2534
+ /**
2535
+ * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
2536
+ * @see aria-atomic.
2537
+ */
2538
+ "aria-relevant"?:
2539
+ | "additions"
2540
+ | "additions removals"
2541
+ | "additions text"
2542
+ | "all"
2543
+ | "removals"
2544
+ | "removals additions"
2545
+ | "removals text"
2546
+ | "text"
2547
+ | "text additions"
2548
+ | "text removals"
2549
+ | undefined;
2550
+ /** Indicates that user input is required on the element before a form may be submitted. */
2551
+ "aria-required"?: Booleanish | undefined;
2552
+ /** Defines a human-readable, author-localized description for the role of an element. */
2553
+ "aria-roledescription"?: string | undefined;
2554
+ /**
2555
+ * Defines the total number of rows in a table, grid, or treegrid.
2556
+ * @see aria-rowindex.
2557
+ */
2558
+ "aria-rowcount"?: number | undefined;
2559
+ /**
2560
+ * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
2561
+ * @see aria-rowcount @see aria-rowspan.
2562
+ */
2563
+ "aria-rowindex"?: number | undefined;
2564
+ /**
2565
+ * Defines a human readable text alternative of aria-rowindex.
2566
+ * @see aria-colindextext.
2567
+ */
2568
+ "aria-rowindextext"?: string | undefined;
2569
+ /**
2570
+ * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
2571
+ * @see aria-rowindex @see aria-colspan.
2572
+ */
2573
+ "aria-rowspan"?: number | undefined;
2574
+ /**
2575
+ * Indicates the current "selected" state of various widgets.
2576
+ * @see aria-checked @see aria-pressed.
2577
+ */
2578
+ "aria-selected"?: Booleanish | undefined;
2579
+ /**
2580
+ * 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.
2581
+ * @see aria-posinset.
2582
+ */
2583
+ "aria-setsize"?: number | undefined;
2584
+ /** Indicates if items in a table or grid are sorted in ascending or descending order. */
2585
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
2586
+ /** Defines the maximum allowed value for a range widget. */
2587
+ "aria-valuemax"?: number | undefined;
2588
+ /** Defines the minimum allowed value for a range widget. */
2589
+ "aria-valuemin"?: number | undefined;
2590
+ /**
2591
+ * Defines the current value for a range widget.
2592
+ * @see aria-valuetext.
2593
+ */
2594
+ "aria-valuenow"?: number | undefined;
2595
+ /** Defines the human readable text alternative of aria-valuenow for a range widget. */
2596
+ "aria-valuetext"?: string | undefined;
2597
+ }
2598
+
2599
+ // All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions
2600
+ type AriaRole =
2601
+ | "alert"
2602
+ | "alertdialog"
2603
+ | "application"
2604
+ | "article"
2605
+ | "banner"
2606
+ | "button"
2607
+ | "cell"
2608
+ | "checkbox"
2609
+ | "columnheader"
2610
+ | "combobox"
2611
+ | "complementary"
2612
+ | "contentinfo"
2613
+ | "definition"
2614
+ | "dialog"
2615
+ | "directory"
2616
+ | "document"
2617
+ | "feed"
2618
+ | "figure"
2619
+ | "form"
2620
+ | "grid"
2621
+ | "gridcell"
2622
+ | "group"
2623
+ | "heading"
2624
+ | "img"
2625
+ | "link"
2626
+ | "list"
2627
+ | "listbox"
2628
+ | "listitem"
2629
+ | "log"
2630
+ | "main"
2631
+ | "marquee"
2632
+ | "math"
2633
+ | "menu"
2634
+ | "menubar"
2635
+ | "menuitem"
2636
+ | "menuitemcheckbox"
2637
+ | "menuitemradio"
2638
+ | "navigation"
2639
+ | "none"
2640
+ | "note"
2641
+ | "option"
2642
+ | "presentation"
2643
+ | "progressbar"
2644
+ | "radio"
2645
+ | "radiogroup"
2646
+ | "region"
2647
+ | "row"
2648
+ | "rowgroup"
2649
+ | "rowheader"
2650
+ | "scrollbar"
2651
+ | "search"
2652
+ | "searchbox"
2653
+ | "separator"
2654
+ | "slider"
2655
+ | "spinbutton"
2656
+ | "status"
2657
+ | "switch"
2658
+ | "tab"
2659
+ | "table"
2660
+ | "tablist"
2661
+ | "tabpanel"
2662
+ | "term"
2663
+ | "textbox"
2664
+ | "timer"
2665
+ | "toolbar"
2666
+ | "tooltip"
2667
+ | "tree"
2668
+ | "treegrid"
2669
+ | "treeitem"
2670
+ | (string & {});
2671
+
2672
+ interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
2673
+ // React-specific Attributes
2674
+ defaultChecked?: boolean | undefined;
2675
+ defaultValue?: string | number | readonly string[] | undefined;
2676
+ suppressContentEditableWarning?: boolean | undefined;
2677
+ suppressHydrationWarning?: boolean | undefined;
2678
+
2679
+ // Standard HTML Attributes
2680
+ accessKey?: string | undefined;
2681
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
2682
+ autoFocus?: boolean | undefined;
2683
+ className?: string | undefined;
2684
+ contentEditable?: Booleanish | "inherit" | "plaintext-only" | undefined;
2685
+ contextMenu?: string | undefined;
2686
+ dir?: string | undefined;
2687
+ draggable?: Booleanish | undefined;
2688
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
2689
+ hidden?: boolean | undefined;
2690
+ id?: string | undefined;
2691
+ lang?: string | undefined;
2692
+ nonce?: string | undefined;
2693
+ slot?: string | undefined;
2694
+ spellCheck?: Booleanish | undefined;
2695
+ style?: CSSProperties | undefined;
2696
+ tabIndex?: number | undefined;
2697
+ title?: string | undefined;
2698
+ translate?: "yes" | "no" | undefined;
2699
+
2700
+ // Unknown
2701
+ radioGroup?: string | undefined; // <command>, <menuitem>
2702
+
2703
+ // WAI-ARIA
2704
+ role?: AriaRole | undefined;
2705
+
2706
+ // RDFa Attributes
2707
+ about?: string | undefined;
2708
+ content?: string | undefined;
2709
+ datatype?: string | undefined;
2710
+ inlist?: any;
2711
+ prefix?: string | undefined;
2712
+ property?: string | undefined;
2713
+ rel?: string | undefined;
2714
+ resource?: string | undefined;
2715
+ rev?: string | undefined;
2716
+ typeof?: string | undefined;
2717
+ vocab?: string | undefined;
2718
+
2719
+ // Non-standard Attributes
2720
+ autoCorrect?: string | undefined;
2721
+ autoSave?: string | undefined;
2722
+ color?: string | undefined;
2723
+ itemProp?: string | undefined;
2724
+ itemScope?: boolean | undefined;
2725
+ itemType?: string | undefined;
2726
+ itemID?: string | undefined;
2727
+ itemRef?: string | undefined;
2728
+ results?: number | undefined;
2729
+ security?: string | undefined;
2730
+ unselectable?: "on" | "off" | undefined;
2731
+
2732
+ // Popover API
2733
+ popover?: "" | "auto" | "manual" | undefined;
2734
+ popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
2735
+ popoverTarget?: string | undefined;
2736
+
2737
+ // Living Standard
2738
+ /**
2739
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
2740
+ */
2741
+ inert?: boolean | undefined;
2742
+ /**
2743
+ * Hints at the type of data that might be entered by the user while editing the element or its contents
2744
+ * @see {@link https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute}
2745
+ */
2746
+ inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
2747
+ /**
2748
+ * Specify that a standard HTML element should behave like a defined custom built-in element
2749
+ * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is}
2750
+ */
2751
+ is?: string | undefined;
2752
+ }
2753
+
2754
+ /**
2755
+ * For internal usage only.
2756
+ * Different release channels declare additional types of ReactNode this particular release channel accepts.
2757
+ * App or library types should never augment this interface.
2758
+ */
2759
+ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {}
2760
+
2761
+ interface AllHTMLAttributes<T> extends HTMLAttributes<T> {
2762
+ // Standard HTML Attributes
2763
+ accept?: string | undefined;
2764
+ acceptCharset?: string | undefined;
2765
+ action?:
2766
+ | string
2767
+ | undefined
2768
+ | ((formData: FormData) => void | Promise<void>)
2769
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
2770
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
2771
+ ];
2772
+ allowFullScreen?: boolean | undefined;
2773
+ allowTransparency?: boolean | undefined;
2774
+ alt?: string | undefined;
2775
+ as?: string | undefined;
2776
+ async?: boolean | undefined;
2777
+ autoComplete?: string | undefined;
2778
+ autoPlay?: boolean | undefined;
2779
+ capture?: boolean | "user" | "environment" | undefined;
2780
+ cellPadding?: number | string | undefined;
2781
+ cellSpacing?: number | string | undefined;
2782
+ charSet?: string | undefined;
2783
+ challenge?: string | undefined;
2784
+ checked?: boolean | undefined;
2785
+ cite?: string | undefined;
2786
+ classID?: string | undefined;
2787
+ cols?: number | undefined;
2788
+ colSpan?: number | undefined;
2789
+ controls?: boolean | undefined;
2790
+ coords?: string | undefined;
2791
+ crossOrigin?: CrossOrigin;
2792
+ data?: string | undefined;
2793
+ dateTime?: string | undefined;
2794
+ default?: boolean | undefined;
2795
+ defer?: boolean | undefined;
2796
+ disabled?: boolean | undefined;
2797
+ download?: any;
2798
+ encType?: string | undefined;
2799
+ form?: string | undefined;
2800
+ formAction?:
2801
+ | string
2802
+ | undefined
2803
+ | ((formData: FormData) => void | Promise<void>)
2804
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
2805
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
2806
+ ];
2807
+ formEncType?: string | undefined;
2808
+ formMethod?: string | undefined;
2809
+ formNoValidate?: boolean | undefined;
2810
+ formTarget?: string | undefined;
2811
+ frameBorder?: number | string | undefined;
2812
+ headers?: string | undefined;
2813
+ height?: number | string | undefined;
2814
+ high?: number | undefined;
2815
+ href?: string | undefined;
2816
+ hrefLang?: string | undefined;
2817
+ htmlFor?: string | undefined;
2818
+ httpEquiv?: string | undefined;
2819
+ integrity?: string | undefined;
2820
+ keyParams?: string | undefined;
2821
+ keyType?: string | undefined;
2822
+ kind?: string | undefined;
2823
+ label?: string | undefined;
2824
+ list?: string | undefined;
2825
+ loop?: boolean | undefined;
2826
+ low?: number | undefined;
2827
+ manifest?: string | undefined;
2828
+ marginHeight?: number | undefined;
2829
+ marginWidth?: number | undefined;
2830
+ max?: number | string | undefined;
2831
+ maxLength?: number | undefined;
2832
+ media?: string | undefined;
2833
+ mediaGroup?: string | undefined;
2834
+ method?: string | undefined;
2835
+ min?: number | string | undefined;
2836
+ minLength?: number | undefined;
2837
+ multiple?: boolean | undefined;
2838
+ muted?: boolean | undefined;
2839
+ name?: string | undefined;
2840
+ noValidate?: boolean | undefined;
2841
+ open?: boolean | undefined;
2842
+ optimum?: number | undefined;
2843
+ pattern?: string | undefined;
2844
+ placeholder?: string | undefined;
2845
+ playsInline?: boolean | undefined;
2846
+ poster?: string | undefined;
2847
+ preload?: string | undefined;
2848
+ readOnly?: boolean | undefined;
2849
+ required?: boolean | undefined;
2850
+ reversed?: boolean | undefined;
2851
+ rows?: number | undefined;
2852
+ rowSpan?: number | undefined;
2853
+ sandbox?: string | undefined;
2854
+ scope?: string | undefined;
2855
+ scoped?: boolean | undefined;
2856
+ scrolling?: string | undefined;
2857
+ seamless?: boolean | undefined;
2858
+ selected?: boolean | undefined;
2859
+ shape?: string | undefined;
2860
+ size?: number | undefined;
2861
+ sizes?: string | undefined;
2862
+ span?: number | undefined;
2863
+ src?: string | undefined;
2864
+ srcDoc?: string | undefined;
2865
+ srcLang?: string | undefined;
2866
+ srcSet?: string | undefined;
2867
+ start?: number | undefined;
2868
+ step?: number | string | undefined;
2869
+ summary?: string | undefined;
2870
+ target?: string | undefined;
2871
+ type?: string | undefined;
2872
+ useMap?: string | undefined;
2873
+ value?: string | readonly string[] | number | undefined;
2874
+ width?: number | string | undefined;
2875
+ wmode?: string | undefined;
2876
+ wrap?: string | undefined;
2877
+ }
2878
+
2879
+ type HTMLAttributeReferrerPolicy =
2880
+ | ""
2881
+ | "no-referrer"
2882
+ | "no-referrer-when-downgrade"
2883
+ | "origin"
2884
+ | "origin-when-cross-origin"
2885
+ | "same-origin"
2886
+ | "strict-origin"
2887
+ | "strict-origin-when-cross-origin"
2888
+ | "unsafe-url";
2889
+
2890
+ type HTMLAttributeAnchorTarget =
2891
+ | "_self"
2892
+ | "_blank"
2893
+ | "_parent"
2894
+ | "_top"
2895
+ | (string & {});
2896
+
2897
+ interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
2898
+ download?: any;
2899
+ href?: string | undefined;
2900
+ hrefLang?: string | undefined;
2901
+ media?: string | undefined;
2902
+ ping?: string | undefined;
2903
+ target?: HTMLAttributeAnchorTarget | undefined;
2904
+ type?: string | undefined;
2905
+ referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
2906
+ }
2907
+
2908
+ interface AudioHTMLAttributes<T> extends MediaHTMLAttributes<T> {}
2909
+
2910
+ interface AreaHTMLAttributes<T> extends HTMLAttributes<T> {
2911
+ alt?: string | undefined;
2912
+ coords?: string | undefined;
2913
+ download?: any;
2914
+ href?: string | undefined;
2915
+ hrefLang?: string | undefined;
2916
+ media?: string | undefined;
2917
+ referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
2918
+ shape?: string | undefined;
2919
+ target?: string | undefined;
2920
+ }
2921
+
2922
+ interface BaseHTMLAttributes<T> extends HTMLAttributes<T> {
2923
+ href?: string | undefined;
2924
+ target?: string | undefined;
2925
+ }
2926
+
2927
+ interface BlockquoteHTMLAttributes<T> extends HTMLAttributes<T> {
2928
+ cite?: string | undefined;
2929
+ }
2930
+
2931
+ interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
2932
+ disabled?: boolean | undefined;
2933
+ form?: string | undefined;
2934
+ formAction?:
2935
+ | string
2936
+ | ((formData: FormData) => void | Promise<void>)
2937
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
2938
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
2939
+ ]
2940
+ | undefined;
2941
+ formEncType?: string | undefined;
2942
+ formMethod?: string | undefined;
2943
+ formNoValidate?: boolean | undefined;
2944
+ formTarget?: string | undefined;
2945
+ name?: string | undefined;
2946
+ type?: "submit" | "reset" | "button" | undefined;
2947
+ value?: string | readonly string[] | number | undefined;
2948
+ }
2949
+
2950
+ interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> {
2951
+ height?: number | string | undefined;
2952
+ width?: number | string | undefined;
2953
+ }
2954
+
2955
+ interface ColHTMLAttributes<T> extends HTMLAttributes<T> {
2956
+ span?: number | undefined;
2957
+ width?: number | string | undefined;
2958
+ }
2959
+
2960
+ interface ColgroupHTMLAttributes<T> extends HTMLAttributes<T> {
2961
+ span?: number | undefined;
2962
+ }
2963
+
2964
+ interface DataHTMLAttributes<T> extends HTMLAttributes<T> {
2965
+ value?: string | readonly string[] | number | undefined;
2966
+ }
2967
+
2968
+ interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> {
2969
+ open?: boolean | undefined;
2970
+ name?: string | undefined;
2971
+ }
2972
+
2973
+ interface DelHTMLAttributes<T> extends HTMLAttributes<T> {
2974
+ cite?: string | undefined;
2975
+ dateTime?: string | undefined;
2976
+ }
2977
+
2978
+ interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
2979
+ onCancel?: ReactEventHandler<T> | undefined;
2980
+ onClose?: ReactEventHandler<T> | undefined;
2981
+ open?: boolean | undefined;
2982
+ }
2983
+
2984
+ interface EmbedHTMLAttributes<T> extends HTMLAttributes<T> {
2985
+ height?: number | string | undefined;
2986
+ src?: string | undefined;
2987
+ type?: string | undefined;
2988
+ width?: number | string | undefined;
2989
+ }
2990
+
2991
+ interface FieldsetHTMLAttributes<T> extends HTMLAttributes<T> {
2992
+ disabled?: boolean | undefined;
2993
+ form?: string | undefined;
2994
+ name?: string | undefined;
2995
+ }
2996
+
2997
+ interface FormHTMLAttributes<T> extends HTMLAttributes<T> {
2998
+ acceptCharset?: string | undefined;
2999
+ action?:
3000
+ | string
3001
+ | undefined
3002
+ | ((formData: FormData) => void | Promise<void>)
3003
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
3004
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
3005
+ ];
3006
+ autoComplete?: string | undefined;
3007
+ encType?: string | undefined;
3008
+ method?: string | undefined;
3009
+ name?: string | undefined;
3010
+ noValidate?: boolean | undefined;
3011
+ target?: string | undefined;
3012
+ }
3013
+
3014
+ interface HtmlHTMLAttributes<T> extends HTMLAttributes<T> {
3015
+ manifest?: string | undefined;
3016
+ }
3017
+
3018
+ interface IframeHTMLAttributes<T> extends HTMLAttributes<T> {
3019
+ allow?: string | undefined;
3020
+ allowFullScreen?: boolean | undefined;
3021
+ allowTransparency?: boolean | undefined;
3022
+ /** @deprecated */
3023
+ frameBorder?: number | string | undefined;
3024
+ height?: number | string | undefined;
3025
+ loading?: "eager" | "lazy" | undefined;
3026
+ /** @deprecated */
3027
+ marginHeight?: number | undefined;
3028
+ /** @deprecated */
3029
+ marginWidth?: number | undefined;
3030
+ name?: string | undefined;
3031
+ referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
3032
+ sandbox?: string | undefined;
3033
+ /** @deprecated */
3034
+ scrolling?: string | undefined;
3035
+ seamless?: boolean | undefined;
3036
+ src?: string | undefined;
3037
+ srcDoc?: string | undefined;
3038
+ width?: number | string | undefined;
3039
+ }
3040
+
3041
+ interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
3042
+ alt?: string | undefined;
3043
+ crossOrigin?: CrossOrigin;
3044
+ decoding?: "async" | "auto" | "sync" | undefined;
3045
+ fetchPriority?: "high" | "low" | "auto";
3046
+ height?: number | string | undefined;
3047
+ loading?: "eager" | "lazy" | undefined;
3048
+ referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
3049
+ sizes?: string | undefined;
3050
+ src?: string | undefined;
3051
+ srcSet?: string | undefined;
3052
+ useMap?: string | undefined;
3053
+ width?: number | string | undefined;
3054
+ }
3055
+
3056
+ interface InsHTMLAttributes<T> extends HTMLAttributes<T> {
3057
+ cite?: string | undefined;
3058
+ dateTime?: string | undefined;
3059
+ }
3060
+
3061
+ type HTMLInputTypeAttribute =
3062
+ | "button"
3063
+ | "checkbox"
3064
+ | "color"
3065
+ | "date"
3066
+ | "datetime-local"
3067
+ | "email"
3068
+ | "file"
3069
+ | "hidden"
3070
+ | "image"
3071
+ | "month"
3072
+ | "number"
3073
+ | "password"
3074
+ | "radio"
3075
+ | "range"
3076
+ | "reset"
3077
+ | "search"
3078
+ | "submit"
3079
+ | "tel"
3080
+ | "text"
3081
+ | "time"
3082
+ | "url"
3083
+ | "week"
3084
+ | (string & {});
3085
+
3086
+ type AutoFillAddressKind = "billing" | "shipping";
3087
+ type AutoFillBase = "" | "off" | "on";
3088
+ type AutoFillContactField =
3089
+ | "email"
3090
+ | "tel"
3091
+ | "tel-area-code"
3092
+ | "tel-country-code"
3093
+ | "tel-extension"
3094
+ | "tel-local"
3095
+ | "tel-local-prefix"
3096
+ | "tel-local-suffix"
3097
+ | "tel-national";
3098
+ type AutoFillContactKind = "home" | "mobile" | "work";
3099
+ type AutoFillCredentialField = "webauthn";
3100
+ type AutoFillNormalField =
3101
+ | "additional-name"
3102
+ | "address-level1"
3103
+ | "address-level2"
3104
+ | "address-level3"
3105
+ | "address-level4"
3106
+ | "address-line1"
3107
+ | "address-line2"
3108
+ | "address-line3"
3109
+ | "bday-day"
3110
+ | "bday-month"
3111
+ | "bday-year"
3112
+ | "cc-csc"
3113
+ | "cc-exp"
3114
+ | "cc-exp-month"
3115
+ | "cc-exp-year"
3116
+ | "cc-family-name"
3117
+ | "cc-given-name"
3118
+ | "cc-name"
3119
+ | "cc-number"
3120
+ | "cc-type"
3121
+ | "country"
3122
+ | "country-name"
3123
+ | "current-password"
3124
+ | "family-name"
3125
+ | "given-name"
3126
+ | "honorific-prefix"
3127
+ | "honorific-suffix"
3128
+ | "name"
3129
+ | "new-password"
3130
+ | "one-time-code"
3131
+ | "organization"
3132
+ | "postal-code"
3133
+ | "street-address"
3134
+ | "transaction-amount"
3135
+ | "transaction-currency"
3136
+ | "username";
3137
+ type OptionalPrefixToken<T extends string> = `${T} ` | "";
3138
+ type OptionalPostfixToken<T extends string> = ` ${T}` | "";
3139
+ type AutoFillField = AutoFillNormalField | `${OptionalPrefixToken<AutoFillContactKind>}${AutoFillContactField}`;
3140
+ type AutoFillSection = `section-${string}`;
3141
+ type AutoFill =
3142
+ | AutoFillBase
3143
+ | `${OptionalPrefixToken<AutoFillSection>}${OptionalPrefixToken<
3144
+ AutoFillAddressKind
3145
+ >}${AutoFillField}${OptionalPostfixToken<AutoFillCredentialField>}`;
3146
+ type HTMLInputAutoCompleteAttribute = AutoFill | (string & {});
3147
+
3148
+ interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
3149
+ accept?: string | undefined;
3150
+ alt?: string | undefined;
3151
+ autoComplete?: HTMLInputAutoCompleteAttribute | undefined;
3152
+ capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
3153
+ checked?: boolean | undefined;
3154
+ disabled?: boolean | undefined;
3155
+ form?: string | undefined;
3156
+ formAction?:
3157
+ | string
3158
+ | ((formData: FormData) => void | Promise<void>)
3159
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
3160
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
3161
+ ]
3162
+ | undefined;
3163
+ formEncType?: string | undefined;
3164
+ formMethod?: string | undefined;
3165
+ formNoValidate?: boolean | undefined;
3166
+ formTarget?: string | undefined;
3167
+ height?: number | string | undefined;
3168
+ list?: string | undefined;
3169
+ max?: number | string | undefined;
3170
+ maxLength?: number | undefined;
3171
+ min?: number | string | undefined;
3172
+ minLength?: number | undefined;
3173
+ multiple?: boolean | undefined;
3174
+ name?: string | undefined;
3175
+ pattern?: string | undefined;
3176
+ placeholder?: string | undefined;
3177
+ readOnly?: boolean | undefined;
3178
+ required?: boolean | undefined;
3179
+ size?: number | undefined;
3180
+ src?: string | undefined;
3181
+ step?: number | string | undefined;
3182
+ type?: HTMLInputTypeAttribute | undefined;
3183
+ value?: string | readonly string[] | number | undefined;
3184
+ width?: number | string | undefined;
3185
+
3186
+ onChange?: ChangeEventHandler<T> | undefined;
3187
+ }
3188
+
3189
+ interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
3190
+ challenge?: string | undefined;
3191
+ disabled?: boolean | undefined;
3192
+ form?: string | undefined;
3193
+ keyType?: string | undefined;
3194
+ keyParams?: string | undefined;
3195
+ name?: string | undefined;
3196
+ }
3197
+
3198
+ interface LabelHTMLAttributes<T> extends HTMLAttributes<T> {
3199
+ form?: string | undefined;
3200
+ htmlFor?: string | undefined;
3201
+ }
3202
+
3203
+ interface LiHTMLAttributes<T> extends HTMLAttributes<T> {
3204
+ value?: string | readonly string[] | number | undefined;
3205
+ }
3206
+
3207
+ interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
3208
+ as?: string | undefined;
3209
+ crossOrigin?: CrossOrigin;
3210
+ fetchPriority?: "high" | "low" | "auto";
3211
+ href?: string | undefined;
3212
+ hrefLang?: string | undefined;
3213
+ integrity?: string | undefined;
3214
+ media?: string | undefined;
3215
+ imageSrcSet?: string | undefined;
3216
+ imageSizes?: string | undefined;
3217
+ referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
3218
+ sizes?: string | undefined;
3219
+ type?: string | undefined;
3220
+ charSet?: string | undefined;
3221
+
3222
+ // React props
3223
+ precedence?: string | undefined;
3224
+ }
3225
+
3226
+ interface MapHTMLAttributes<T> extends HTMLAttributes<T> {
3227
+ name?: string | undefined;
3228
+ }
3229
+
3230
+ interface MenuHTMLAttributes<T> extends HTMLAttributes<T> {
3231
+ type?: string | undefined;
3232
+ }
3233
+
3234
+ interface MediaHTMLAttributes<T> extends HTMLAttributes<T> {
3235
+ autoPlay?: boolean | undefined;
3236
+ controls?: boolean | undefined;
3237
+ controlsList?: string | undefined;
3238
+ crossOrigin?: CrossOrigin;
3239
+ loop?: boolean | undefined;
3240
+ mediaGroup?: string | undefined;
3241
+ muted?: boolean | undefined;
3242
+ playsInline?: boolean | undefined;
3243
+ preload?: string | undefined;
3244
+ src?: string | undefined;
3245
+ }
3246
+
3247
+ interface MetaHTMLAttributes<T> extends HTMLAttributes<T> {
3248
+ charSet?: string | undefined;
3249
+ content?: string | undefined;
3250
+ httpEquiv?: string | undefined;
3251
+ media?: string | undefined;
3252
+ name?: string | undefined;
3253
+ }
3254
+
3255
+ interface MeterHTMLAttributes<T> extends HTMLAttributes<T> {
3256
+ form?: string | undefined;
3257
+ high?: number | undefined;
3258
+ low?: number | undefined;
3259
+ max?: number | string | undefined;
3260
+ min?: number | string | undefined;
3261
+ optimum?: number | undefined;
3262
+ value?: string | readonly string[] | number | undefined;
3263
+ }
3264
+
3265
+ interface QuoteHTMLAttributes<T> extends HTMLAttributes<T> {
3266
+ cite?: string | undefined;
3267
+ }
3268
+
3269
+ interface ObjectHTMLAttributes<T> extends HTMLAttributes<T> {
3270
+ classID?: string | undefined;
3271
+ data?: string | undefined;
3272
+ form?: string | undefined;
3273
+ height?: number | string | undefined;
3274
+ name?: string | undefined;
3275
+ type?: string | undefined;
3276
+ useMap?: string | undefined;
3277
+ width?: number | string | undefined;
3278
+ wmode?: string | undefined;
3279
+ }
3280
+
3281
+ interface OlHTMLAttributes<T> extends HTMLAttributes<T> {
3282
+ reversed?: boolean | undefined;
3283
+ start?: number | undefined;
3284
+ type?: "1" | "a" | "A" | "i" | "I" | undefined;
3285
+ }
3286
+
3287
+ interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> {
3288
+ disabled?: boolean | undefined;
3289
+ label?: string | undefined;
3290
+ }
3291
+
3292
+ interface OptionHTMLAttributes<T> extends HTMLAttributes<T> {
3293
+ disabled?: boolean | undefined;
3294
+ label?: string | undefined;
3295
+ selected?: boolean | undefined;
3296
+ value?: string | readonly string[] | number | undefined;
3297
+ }
3298
+
3299
+ interface OutputHTMLAttributes<T> extends HTMLAttributes<T> {
3300
+ form?: string | undefined;
3301
+ htmlFor?: string | undefined;
3302
+ name?: string | undefined;
3303
+ }
3304
+
3305
+ interface ParamHTMLAttributes<T> extends HTMLAttributes<T> {
3306
+ name?: string | undefined;
3307
+ value?: string | readonly string[] | number | undefined;
3308
+ }
3309
+
3310
+ interface ProgressHTMLAttributes<T> extends HTMLAttributes<T> {
3311
+ max?: number | string | undefined;
3312
+ value?: string | readonly string[] | number | undefined;
3313
+ }
3314
+
3315
+ interface SlotHTMLAttributes<T> extends HTMLAttributes<T> {
3316
+ name?: string | undefined;
3317
+ }
3318
+
3319
+ interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
3320
+ async?: boolean | undefined;
3321
+ /** @deprecated */
3322
+ charSet?: string | undefined;
3323
+ crossOrigin?: CrossOrigin;
3324
+ defer?: boolean | undefined;
3325
+ integrity?: string | undefined;
3326
+ noModule?: boolean | undefined;
3327
+ referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
3328
+ src?: string | undefined;
3329
+ type?: string | undefined;
3330
+ }
3331
+
3332
+ interface SelectHTMLAttributes<T> extends HTMLAttributes<T> {
3333
+ autoComplete?: string | undefined;
3334
+ disabled?: boolean | undefined;
3335
+ form?: string | undefined;
3336
+ multiple?: boolean | undefined;
3337
+ name?: string | undefined;
3338
+ required?: boolean | undefined;
3339
+ size?: number | undefined;
3340
+ value?: string | readonly string[] | number | undefined;
3341
+ onChange?: ChangeEventHandler<T> | undefined;
3342
+ }
3343
+
3344
+ interface SourceHTMLAttributes<T> extends HTMLAttributes<T> {
3345
+ height?: number | string | undefined;
3346
+ media?: string | undefined;
3347
+ sizes?: string | undefined;
3348
+ src?: string | undefined;
3349
+ srcSet?: string | undefined;
3350
+ type?: string | undefined;
3351
+ width?: number | string | undefined;
3352
+ }
3353
+
3354
+ interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
3355
+ media?: string | undefined;
3356
+ scoped?: boolean | undefined;
3357
+ type?: string | undefined;
3358
+
3359
+ // React props
3360
+ href?: string | undefined;
3361
+ precedence?: string | undefined;
3362
+ }
3363
+
3364
+ interface TableHTMLAttributes<T> extends HTMLAttributes<T> {
3365
+ align?: "left" | "center" | "right" | undefined;
3366
+ bgcolor?: string | undefined;
3367
+ border?: number | undefined;
3368
+ cellPadding?: number | string | undefined;
3369
+ cellSpacing?: number | string | undefined;
3370
+ frame?: boolean | undefined;
3371
+ rules?: "none" | "groups" | "rows" | "columns" | "all" | undefined;
3372
+ summary?: string | undefined;
3373
+ width?: number | string | undefined;
3374
+ }
3375
+
3376
+ interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> {
3377
+ autoComplete?: string | undefined;
3378
+ cols?: number | undefined;
3379
+ dirName?: string | undefined;
3380
+ disabled?: boolean | undefined;
3381
+ form?: string | undefined;
3382
+ maxLength?: number | undefined;
3383
+ minLength?: number | undefined;
3384
+ name?: string | undefined;
3385
+ placeholder?: string | undefined;
3386
+ readOnly?: boolean | undefined;
3387
+ required?: boolean | undefined;
3388
+ rows?: number | undefined;
3389
+ value?: string | readonly string[] | number | undefined;
3390
+ wrap?: string | undefined;
3391
+
3392
+ onChange?: ChangeEventHandler<T> | undefined;
3393
+ }
3394
+
3395
+ interface TdHTMLAttributes<T> extends HTMLAttributes<T> {
3396
+ align?: "left" | "center" | "right" | "justify" | "char" | undefined;
3397
+ colSpan?: number | undefined;
3398
+ headers?: string | undefined;
3399
+ rowSpan?: number | undefined;
3400
+ scope?: string | undefined;
3401
+ abbr?: string | undefined;
3402
+ height?: number | string | undefined;
3403
+ width?: number | string | undefined;
3404
+ valign?: "top" | "middle" | "bottom" | "baseline" | undefined;
3405
+ }
3406
+
3407
+ interface ThHTMLAttributes<T> extends HTMLAttributes<T> {
3408
+ align?: "left" | "center" | "right" | "justify" | "char" | undefined;
3409
+ colSpan?: number | undefined;
3410
+ headers?: string | undefined;
3411
+ rowSpan?: number | undefined;
3412
+ scope?: string | undefined;
3413
+ abbr?: string | undefined;
3414
+ }
3415
+
3416
+ interface TimeHTMLAttributes<T> extends HTMLAttributes<T> {
3417
+ dateTime?: string | undefined;
3418
+ }
3419
+
3420
+ interface TrackHTMLAttributes<T> extends HTMLAttributes<T> {
3421
+ default?: boolean | undefined;
3422
+ kind?: string | undefined;
3423
+ label?: string | undefined;
3424
+ src?: string | undefined;
3425
+ srcLang?: string | undefined;
3426
+ }
3427
+
3428
+ interface VideoHTMLAttributes<T> extends MediaHTMLAttributes<T> {
3429
+ height?: number | string | undefined;
3430
+ playsInline?: boolean | undefined;
3431
+ poster?: string | undefined;
3432
+ width?: number | string | undefined;
3433
+ disablePictureInPicture?: boolean | undefined;
3434
+ disableRemotePlayback?: boolean | undefined;
3435
+ }
3436
+
3437
+ // this list is "complete" in that it contains every SVG attribute
3438
+ // that React supports, but the types can be improved.
3439
+ // Full list here: https://facebook.github.io/react/docs/dom-elements.html
3440
+ //
3441
+ // The three broad type categories are (in order of restrictiveness):
3442
+ // - "number | string"
3443
+ // - "string"
3444
+ // - union of string literals
3445
+ interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
3446
+ // React-specific Attributes
3447
+ suppressHydrationWarning?: boolean | undefined;
3448
+
3449
+ // Attributes which also defined in HTMLAttributes
3450
+ // See comment in SVGDOMPropertyConfig.js
3451
+ className?: string | undefined;
3452
+ color?: string | undefined;
3453
+ height?: number | string | undefined;
3454
+ id?: string | undefined;
3455
+ lang?: string | undefined;
3456
+ max?: number | string | undefined;
3457
+ media?: string | undefined;
3458
+ method?: string | undefined;
3459
+ min?: number | string | undefined;
3460
+ name?: string | undefined;
3461
+ style?: CSSProperties | undefined;
3462
+ target?: string | undefined;
3463
+ type?: string | undefined;
3464
+ width?: number | string | undefined;
3465
+
3466
+ // Other HTML properties supported by SVG elements in browsers
3467
+ role?: AriaRole | undefined;
3468
+ tabIndex?: number | undefined;
3469
+ crossOrigin?: CrossOrigin;
3470
+
3471
+ // SVG Specific attributes
3472
+ accentHeight?: number | string | undefined;
3473
+ accumulate?: "none" | "sum" | undefined;
3474
+ additive?: "replace" | "sum" | undefined;
3475
+ alignmentBaseline?:
3476
+ | "auto"
3477
+ | "baseline"
3478
+ | "before-edge"
3479
+ | "text-before-edge"
3480
+ | "middle"
3481
+ | "central"
3482
+ | "after-edge"
3483
+ | "text-after-edge"
3484
+ | "ideographic"
3485
+ | "alphabetic"
3486
+ | "hanging"
3487
+ | "mathematical"
3488
+ | "inherit"
3489
+ | undefined;
3490
+ allowReorder?: "no" | "yes" | undefined;
3491
+ alphabetic?: number | string | undefined;
3492
+ amplitude?: number | string | undefined;
3493
+ arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined;
3494
+ ascent?: number | string | undefined;
3495
+ attributeName?: string | undefined;
3496
+ attributeType?: string | undefined;
3497
+ autoReverse?: Booleanish | undefined;
3498
+ azimuth?: number | string | undefined;
3499
+ baseFrequency?: number | string | undefined;
3500
+ baselineShift?: number | string | undefined;
3501
+ baseProfile?: number | string | undefined;
3502
+ bbox?: number | string | undefined;
3503
+ begin?: number | string | undefined;
3504
+ bias?: number | string | undefined;
3505
+ by?: number | string | undefined;
3506
+ calcMode?: number | string | undefined;
3507
+ capHeight?: number | string | undefined;
3508
+ clip?: number | string | undefined;
3509
+ clipPath?: string | undefined;
3510
+ clipPathUnits?: number | string | undefined;
3511
+ clipRule?: number | string | undefined;
3512
+ colorInterpolation?: number | string | undefined;
3513
+ colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined;
3514
+ colorProfile?: number | string | undefined;
3515
+ colorRendering?: number | string | undefined;
3516
+ contentScriptType?: number | string | undefined;
3517
+ contentStyleType?: number | string | undefined;
3518
+ cursor?: number | string | undefined;
3519
+ cx?: number | string | undefined;
3520
+ cy?: number | string | undefined;
3521
+ d?: string | undefined;
3522
+ decelerate?: number | string | undefined;
3523
+ descent?: number | string | undefined;
3524
+ diffuseConstant?: number | string | undefined;
3525
+ direction?: number | string | undefined;
3526
+ display?: number | string | undefined;
3527
+ divisor?: number | string | undefined;
3528
+ dominantBaseline?: number | string | undefined;
3529
+ dur?: number | string | undefined;
3530
+ dx?: number | string | undefined;
3531
+ dy?: number | string | undefined;
3532
+ edgeMode?: number | string | undefined;
3533
+ elevation?: number | string | undefined;
3534
+ enableBackground?: number | string | undefined;
3535
+ end?: number | string | undefined;
3536
+ exponent?: number | string | undefined;
3537
+ externalResourcesRequired?: Booleanish | undefined;
3538
+ fill?: string | undefined;
3539
+ fillOpacity?: number | string | undefined;
3540
+ fillRule?: "nonzero" | "evenodd" | "inherit" | undefined;
3541
+ filter?: string | undefined;
3542
+ filterRes?: number | string | undefined;
3543
+ filterUnits?: number | string | undefined;
3544
+ floodColor?: number | string | undefined;
3545
+ floodOpacity?: number | string | undefined;
3546
+ focusable?: Booleanish | "auto" | undefined;
3547
+ fontFamily?: string | undefined;
3548
+ fontSize?: number | string | undefined;
3549
+ fontSizeAdjust?: number | string | undefined;
3550
+ fontStretch?: number | string | undefined;
3551
+ fontStyle?: number | string | undefined;
3552
+ fontVariant?: number | string | undefined;
3553
+ fontWeight?: number | string | undefined;
3554
+ format?: number | string | undefined;
3555
+ fr?: number | string | undefined;
3556
+ from?: number | string | undefined;
3557
+ fx?: number | string | undefined;
3558
+ fy?: number | string | undefined;
3559
+ g1?: number | string | undefined;
3560
+ g2?: number | string | undefined;
3561
+ glyphName?: number | string | undefined;
3562
+ glyphOrientationHorizontal?: number | string | undefined;
3563
+ glyphOrientationVertical?: number | string | undefined;
3564
+ glyphRef?: number | string | undefined;
3565
+ gradientTransform?: string | undefined;
3566
+ gradientUnits?: string | undefined;
3567
+ hanging?: number | string | undefined;
3568
+ horizAdvX?: number | string | undefined;
3569
+ horizOriginX?: number | string | undefined;
3570
+ href?: string | undefined;
3571
+ ideographic?: number | string | undefined;
3572
+ imageRendering?: number | string | undefined;
3573
+ in2?: number | string | undefined;
3574
+ in?: string | undefined;
3575
+ intercept?: number | string | undefined;
3576
+ k1?: number | string | undefined;
3577
+ k2?: number | string | undefined;
3578
+ k3?: number | string | undefined;
3579
+ k4?: number | string | undefined;
3580
+ k?: number | string | undefined;
3581
+ kernelMatrix?: number | string | undefined;
3582
+ kernelUnitLength?: number | string | undefined;
3583
+ kerning?: number | string | undefined;
3584
+ keyPoints?: number | string | undefined;
3585
+ keySplines?: number | string | undefined;
3586
+ keyTimes?: number | string | undefined;
3587
+ lengthAdjust?: number | string | undefined;
3588
+ letterSpacing?: number | string | undefined;
3589
+ lightingColor?: number | string | undefined;
3590
+ limitingConeAngle?: number | string | undefined;
3591
+ local?: number | string | undefined;
3592
+ markerEnd?: string | undefined;
3593
+ markerHeight?: number | string | undefined;
3594
+ markerMid?: string | undefined;
3595
+ markerStart?: string | undefined;
3596
+ markerUnits?: number | string | undefined;
3597
+ markerWidth?: number | string | undefined;
3598
+ mask?: string | undefined;
3599
+ maskContentUnits?: number | string | undefined;
3600
+ maskUnits?: number | string | undefined;
3601
+ mathematical?: number | string | undefined;
3602
+ mode?: number | string | undefined;
3603
+ numOctaves?: number | string | undefined;
3604
+ offset?: number | string | undefined;
3605
+ opacity?: number | string | undefined;
3606
+ operator?: number | string | undefined;
3607
+ order?: number | string | undefined;
3608
+ orient?: number | string | undefined;
3609
+ orientation?: number | string | undefined;
3610
+ origin?: number | string | undefined;
3611
+ overflow?: number | string | undefined;
3612
+ overlinePosition?: number | string | undefined;
3613
+ overlineThickness?: number | string | undefined;
3614
+ paintOrder?: number | string | undefined;
3615
+ panose1?: number | string | undefined;
3616
+ path?: string | undefined;
3617
+ pathLength?: number | string | undefined;
3618
+ patternContentUnits?: string | undefined;
3619
+ patternTransform?: number | string | undefined;
3620
+ patternUnits?: string | undefined;
3621
+ pointerEvents?: number | string | undefined;
3622
+ points?: string | undefined;
3623
+ pointsAtX?: number | string | undefined;
3624
+ pointsAtY?: number | string | undefined;
3625
+ pointsAtZ?: number | string | undefined;
3626
+ preserveAlpha?: Booleanish | undefined;
3627
+ preserveAspectRatio?: string | undefined;
3628
+ primitiveUnits?: number | string | undefined;
3629
+ r?: number | string | undefined;
3630
+ radius?: number | string | undefined;
3631
+ refX?: number | string | undefined;
3632
+ refY?: number | string | undefined;
3633
+ renderingIntent?: number | string | undefined;
3634
+ repeatCount?: number | string | undefined;
3635
+ repeatDur?: number | string | undefined;
3636
+ requiredExtensions?: number | string | undefined;
3637
+ requiredFeatures?: number | string | undefined;
3638
+ restart?: number | string | undefined;
3639
+ result?: string | undefined;
3640
+ rotate?: number | string | undefined;
3641
+ rx?: number | string | undefined;
3642
+ ry?: number | string | undefined;
3643
+ scale?: number | string | undefined;
3644
+ seed?: number | string | undefined;
3645
+ shapeRendering?: number | string | undefined;
3646
+ slope?: number | string | undefined;
3647
+ spacing?: number | string | undefined;
3648
+ specularConstant?: number | string | undefined;
3649
+ specularExponent?: number | string | undefined;
3650
+ speed?: number | string | undefined;
3651
+ spreadMethod?: string | undefined;
3652
+ startOffset?: number | string | undefined;
3653
+ stdDeviation?: number | string | undefined;
3654
+ stemh?: number | string | undefined;
3655
+ stemv?: number | string | undefined;
3656
+ stitchTiles?: number | string | undefined;
3657
+ stopColor?: string | undefined;
3658
+ stopOpacity?: number | string | undefined;
3659
+ strikethroughPosition?: number | string | undefined;
3660
+ strikethroughThickness?: number | string | undefined;
3661
+ string?: number | string | undefined;
3662
+ stroke?: string | undefined;
3663
+ strokeDasharray?: string | number | undefined;
3664
+ strokeDashoffset?: string | number | undefined;
3665
+ strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined;
3666
+ strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined;
3667
+ strokeMiterlimit?: number | string | undefined;
3668
+ strokeOpacity?: number | string | undefined;
3669
+ strokeWidth?: number | string | undefined;
3670
+ surfaceScale?: number | string | undefined;
3671
+ systemLanguage?: number | string | undefined;
3672
+ tableValues?: number | string | undefined;
3673
+ targetX?: number | string | undefined;
3674
+ targetY?: number | string | undefined;
3675
+ textAnchor?: string | undefined;
3676
+ textDecoration?: number | string | undefined;
3677
+ textLength?: number | string | undefined;
3678
+ textRendering?: number | string | undefined;
3679
+ to?: number | string | undefined;
3680
+ transform?: string | undefined;
3681
+ u1?: number | string | undefined;
3682
+ u2?: number | string | undefined;
3683
+ underlinePosition?: number | string | undefined;
3684
+ underlineThickness?: number | string | undefined;
3685
+ unicode?: number | string | undefined;
3686
+ unicodeBidi?: number | string | undefined;
3687
+ unicodeRange?: number | string | undefined;
3688
+ unitsPerEm?: number | string | undefined;
3689
+ vAlphabetic?: number | string | undefined;
3690
+ values?: string | undefined;
3691
+ vectorEffect?: number | string | undefined;
3692
+ version?: string | undefined;
3693
+ vertAdvY?: number | string | undefined;
3694
+ vertOriginX?: number | string | undefined;
3695
+ vertOriginY?: number | string | undefined;
3696
+ vHanging?: number | string | undefined;
3697
+ vIdeographic?: number | string | undefined;
3698
+ viewBox?: string | undefined;
3699
+ viewTarget?: number | string | undefined;
3700
+ visibility?: number | string | undefined;
3701
+ vMathematical?: number | string | undefined;
3702
+ widths?: number | string | undefined;
3703
+ wordSpacing?: number | string | undefined;
3704
+ writingMode?: number | string | undefined;
3705
+ x1?: number | string | undefined;
3706
+ x2?: number | string | undefined;
3707
+ x?: number | string | undefined;
3708
+ xChannelSelector?: string | undefined;
3709
+ xHeight?: number | string | undefined;
3710
+ xlinkActuate?: string | undefined;
3711
+ xlinkArcrole?: string | undefined;
3712
+ xlinkHref?: string | undefined;
3713
+ xlinkRole?: string | undefined;
3714
+ xlinkShow?: string | undefined;
3715
+ xlinkTitle?: string | undefined;
3716
+ xlinkType?: string | undefined;
3717
+ xmlBase?: string | undefined;
3718
+ xmlLang?: string | undefined;
3719
+ xmlns?: string | undefined;
3720
+ xmlnsXlink?: string | undefined;
3721
+ xmlSpace?: string | undefined;
3722
+ y1?: number | string | undefined;
3723
+ y2?: number | string | undefined;
3724
+ y?: number | string | undefined;
3725
+ yChannelSelector?: string | undefined;
3726
+ z?: number | string | undefined;
3727
+ zoomAndPan?: string | undefined;
3728
+ }
3729
+
3730
+ interface WebViewHTMLAttributes<T> extends HTMLAttributes<T> {
3731
+ allowFullScreen?: boolean | undefined;
3732
+ allowpopups?: boolean | undefined;
3733
+ autosize?: boolean | undefined;
3734
+ blinkfeatures?: string | undefined;
3735
+ disableblinkfeatures?: string | undefined;
3736
+ disableguestresize?: boolean | undefined;
3737
+ disablewebsecurity?: boolean | undefined;
3738
+ guestinstance?: string | undefined;
3739
+ httpreferrer?: string | undefined;
3740
+ nodeintegration?: boolean | undefined;
3741
+ partition?: string | undefined;
3742
+ plugins?: boolean | undefined;
3743
+ preload?: string | undefined;
3744
+ src?: string | undefined;
3745
+ useragent?: string | undefined;
3746
+ webpreferences?: string | undefined;
3747
+ }
3748
+
3749
+ // TODO: Move to react-dom
3750
+ type HTMLElementType =
3751
+ | "a"
3752
+ | "abbr"
3753
+ | "address"
3754
+ | "area"
3755
+ | "article"
3756
+ | "aside"
3757
+ | "audio"
3758
+ | "b"
3759
+ | "base"
3760
+ | "bdi"
3761
+ | "bdo"
3762
+ | "big"
3763
+ | "blockquote"
3764
+ | "body"
3765
+ | "br"
3766
+ | "button"
3767
+ | "canvas"
3768
+ | "caption"
3769
+ | "center"
3770
+ | "cite"
3771
+ | "code"
3772
+ | "col"
3773
+ | "colgroup"
3774
+ | "data"
3775
+ | "datalist"
3776
+ | "dd"
3777
+ | "del"
3778
+ | "details"
3779
+ | "dfn"
3780
+ | "dialog"
3781
+ | "div"
3782
+ | "dl"
3783
+ | "dt"
3784
+ | "em"
3785
+ | "embed"
3786
+ | "fieldset"
3787
+ | "figcaption"
3788
+ | "figure"
3789
+ | "footer"
3790
+ | "form"
3791
+ | "h1"
3792
+ | "h2"
3793
+ | "h3"
3794
+ | "h4"
3795
+ | "h5"
3796
+ | "h6"
3797
+ | "head"
3798
+ | "header"
3799
+ | "hgroup"
3800
+ | "hr"
3801
+ | "html"
3802
+ | "i"
3803
+ | "iframe"
3804
+ | "img"
3805
+ | "input"
3806
+ | "ins"
3807
+ | "kbd"
3808
+ | "keygen"
3809
+ | "label"
3810
+ | "legend"
3811
+ | "li"
3812
+ | "link"
3813
+ | "main"
3814
+ | "map"
3815
+ | "mark"
3816
+ | "menu"
3817
+ | "menuitem"
3818
+ | "meta"
3819
+ | "meter"
3820
+ | "nav"
3821
+ | "noscript"
3822
+ | "object"
3823
+ | "ol"
3824
+ | "optgroup"
3825
+ | "option"
3826
+ | "output"
3827
+ | "p"
3828
+ | "param"
3829
+ | "picture"
3830
+ | "pre"
3831
+ | "progress"
3832
+ | "q"
3833
+ | "rp"
3834
+ | "rt"
3835
+ | "ruby"
3836
+ | "s"
3837
+ | "samp"
3838
+ | "search"
3839
+ | "slot"
3840
+ | "script"
3841
+ | "section"
3842
+ | "select"
3843
+ | "small"
3844
+ | "source"
3845
+ | "span"
3846
+ | "strong"
3847
+ | "style"
3848
+ | "sub"
3849
+ | "summary"
3850
+ | "sup"
3851
+ | "table"
3852
+ | "template"
3853
+ | "tbody"
3854
+ | "td"
3855
+ | "textarea"
3856
+ | "tfoot"
3857
+ | "th"
3858
+ | "thead"
3859
+ | "time"
3860
+ | "title"
3861
+ | "tr"
3862
+ | "track"
3863
+ | "u"
3864
+ | "ul"
3865
+ | "var"
3866
+ | "video"
3867
+ | "wbr"
3868
+ | "webview";
3869
+
3870
+ // TODO: Move to react-dom
3871
+ type SVGElementType =
3872
+ | "animate"
3873
+ | "circle"
3874
+ | "clipPath"
3875
+ | "defs"
3876
+ | "desc"
3877
+ | "ellipse"
3878
+ | "feBlend"
3879
+ | "feColorMatrix"
3880
+ | "feComponentTransfer"
3881
+ | "feComposite"
3882
+ | "feConvolveMatrix"
3883
+ | "feDiffuseLighting"
3884
+ | "feDisplacementMap"
3885
+ | "feDistantLight"
3886
+ | "feDropShadow"
3887
+ | "feFlood"
3888
+ | "feFuncA"
3889
+ | "feFuncB"
3890
+ | "feFuncG"
3891
+ | "feFuncR"
3892
+ | "feGaussianBlur"
3893
+ | "feImage"
3894
+ | "feMerge"
3895
+ | "feMergeNode"
3896
+ | "feMorphology"
3897
+ | "feOffset"
3898
+ | "fePointLight"
3899
+ | "feSpecularLighting"
3900
+ | "feSpotLight"
3901
+ | "feTile"
3902
+ | "feTurbulence"
3903
+ | "filter"
3904
+ | "foreignObject"
3905
+ | "g"
3906
+ | "image"
3907
+ | "line"
3908
+ | "linearGradient"
3909
+ | "marker"
3910
+ | "mask"
3911
+ | "metadata"
3912
+ | "path"
3913
+ | "pattern"
3914
+ | "polygon"
3915
+ | "polyline"
3916
+ | "radialGradient"
3917
+ | "rect"
3918
+ | "stop"
3919
+ | "svg"
3920
+ | "switch"
3921
+ | "symbol"
3922
+ | "text"
3923
+ | "textPath"
3924
+ | "tspan"
3925
+ | "use"
3926
+ | "view";
3927
+
3928
+ //
3929
+ // Browser Interfaces
3930
+ // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
3931
+ // ----------------------------------------------------------------------
3932
+
3933
+ interface AbstractView {
3934
+ styleMedia: StyleMedia;
3935
+ document: Document;
3936
+ }
3937
+
3938
+ interface Touch {
3939
+ identifier: number;
3940
+ target: EventTarget;
3941
+ screenX: number;
3942
+ screenY: number;
3943
+ clientX: number;
3944
+ clientY: number;
3945
+ pageX: number;
3946
+ pageY: number;
3947
+ }
3948
+
3949
+ interface TouchList {
3950
+ [index: number]: Touch;
3951
+ length: number;
3952
+ item(index: number): Touch;
3953
+ identifiedTouch(identifier: number): Touch;
3954
+ }
3955
+
3956
+ //
3957
+ // Error Interfaces
3958
+ // ----------------------------------------------------------------------
3959
+ interface ErrorInfo {
3960
+ /**
3961
+ * Captures which component contained the exception, and its ancestors.
3962
+ */
3963
+ componentStack?: string | null;
3964
+ digest?: string | null;
3965
+ }
3966
+
3967
+ // Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts
3968
+ namespace JSX {
3969
+ interface Element extends React.ReactElement<any, any> {}
3970
+ interface ElementClass extends React.Component<any> {
3971
+ render(): React.ReactNode;
3972
+ }
3973
+ interface ElementAttributesProperty {
3974
+ props: {};
3975
+ }
3976
+ interface ElementChildrenAttribute {
3977
+ children: {};
3978
+ }
3979
+
3980
+ // We can't recurse forever because `type` can't be self-referential;
3981
+ // let's assume it's reasonable to do a single React.lazy() around a single React.memo() / vice-versa
3982
+ type LibraryManagedAttributes<C, P> = C extends
3983
+ React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
3984
+ ? T extends React.MemoExoticComponent<infer U> | React.LazyExoticComponent<infer U>
3985
+ ? ReactManagedAttributes<U, P>
3986
+ : ReactManagedAttributes<T, P>
3987
+ : ReactManagedAttributes<C, P>;
3988
+
3989
+ interface IntrinsicAttributes extends React.Attributes {}
3990
+ interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {}
3991
+
3992
+ interface IntrinsicElements {
3993
+ // HTML
3994
+ a: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
3995
+ abbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3996
+ address: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3997
+ area: React.DetailedHTMLProps<React.AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
3998
+ article: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3999
+ aside: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4000
+ audio: React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
4001
+ b: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4002
+ base: React.DetailedHTMLProps<React.BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>;
4003
+ bdi: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4004
+ bdo: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4005
+ big: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4006
+ blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
4007
+ body: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
4008
+ br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
4009
+ button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
4010
+ canvas: React.DetailedHTMLProps<React.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>;
4011
+ caption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4012
+ center: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4013
+ cite: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4014
+ code: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4015
+ col: React.DetailedHTMLProps<React.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
4016
+ colgroup: React.DetailedHTMLProps<React.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
4017
+ data: React.DetailedHTMLProps<React.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
4018
+ datalist: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
4019
+ dd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4020
+ del: React.DetailedHTMLProps<React.DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
4021
+ details: React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>;
4022
+ dfn: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4023
+ dialog: React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
4024
+ div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
4025
+ dl: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDListElement>, HTMLDListElement>;
4026
+ dt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4027
+ em: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4028
+ embed: React.DetailedHTMLProps<React.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>;
4029
+ fieldset: React.DetailedHTMLProps<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>;
4030
+ figcaption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4031
+ figure: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4032
+ footer: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4033
+ form: React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;
4034
+ h1: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
4035
+ h2: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
4036
+ h3: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
4037
+ h4: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
4038
+ h5: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
4039
+ h6: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
4040
+ head: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>;
4041
+ header: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4042
+ hgroup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4043
+ hr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHRElement>, HTMLHRElement>;
4044
+ html: React.DetailedHTMLProps<React.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>;
4045
+ i: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4046
+ iframe: React.DetailedHTMLProps<React.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>;
4047
+ img: React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
4048
+ input: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
4049
+ ins: React.DetailedHTMLProps<React.InsHTMLAttributes<HTMLModElement>, HTMLModElement>;
4050
+ kbd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4051
+ keygen: React.DetailedHTMLProps<React.KeygenHTMLAttributes<HTMLElement>, HTMLElement>;
4052
+ label: React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
4053
+ legend: React.DetailedHTMLProps<React.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>;
4054
+ li: React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
4055
+ link: React.DetailedHTMLProps<React.LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>;
4056
+ main: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4057
+ map: React.DetailedHTMLProps<React.MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>;
4058
+ mark: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4059
+ menu: React.DetailedHTMLProps<React.MenuHTMLAttributes<HTMLElement>, HTMLElement>;
4060
+ menuitem: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4061
+ meta: React.DetailedHTMLProps<React.MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
4062
+ meter: React.DetailedHTMLProps<React.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>;
4063
+ nav: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4064
+ noindex: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4065
+ noscript: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4066
+ object: React.DetailedHTMLProps<React.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
4067
+ ol: React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
4068
+ optgroup: React.DetailedHTMLProps<React.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
4069
+ option: React.DetailedHTMLProps<React.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
4070
+ output: React.DetailedHTMLProps<React.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>;
4071
+ p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
4072
+ param: React.DetailedHTMLProps<React.ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
4073
+ picture: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4074
+ pre: React.DetailedHTMLProps<React.HTMLAttributes<HTMLPreElement>, HTMLPreElement>;
4075
+ progress: React.DetailedHTMLProps<React.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>;
4076
+ q: React.DetailedHTMLProps<React.QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
4077
+ rp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4078
+ rt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4079
+ ruby: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4080
+ s: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4081
+ samp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4082
+ search: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4083
+ slot: React.DetailedHTMLProps<React.SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>;
4084
+ script: React.DetailedHTMLProps<React.ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>;
4085
+ section: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4086
+ select: React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
4087
+ small: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4088
+ source: React.DetailedHTMLProps<React.SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>;
4089
+ span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
4090
+ strong: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4091
+ style: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;
4092
+ sub: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4093
+ summary: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4094
+ sup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4095
+ table: React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>;
4096
+ template: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>;
4097
+ tbody: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
4098
+ td: React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>;
4099
+ textarea: React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
4100
+ tfoot: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
4101
+ th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
4102
+ thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
4103
+ time: React.DetailedHTMLProps<React.TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>;
4104
+ title: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
4105
+ tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
4106
+ track: React.DetailedHTMLProps<React.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
4107
+ u: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4108
+ ul: React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>;
4109
+ "var": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4110
+ video: React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
4111
+ wbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
4112
+ webview: React.DetailedHTMLProps<React.WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>;
4113
+
4114
+ // SVG
4115
+ svg: React.SVGProps<SVGSVGElement>;
4116
+
4117
+ animate: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateElement but is not in TypeScript's lib.dom.d.ts for now.
4118
+ animateMotion: React.SVGProps<SVGElement>;
4119
+ animateTransform: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateTransformElement but is not in TypeScript's lib.dom.d.ts for now.
4120
+ circle: React.SVGProps<SVGCircleElement>;
4121
+ clipPath: React.SVGProps<SVGClipPathElement>;
4122
+ defs: React.SVGProps<SVGDefsElement>;
4123
+ desc: React.SVGProps<SVGDescElement>;
4124
+ ellipse: React.SVGProps<SVGEllipseElement>;
4125
+ feBlend: React.SVGProps<SVGFEBlendElement>;
4126
+ feColorMatrix: React.SVGProps<SVGFEColorMatrixElement>;
4127
+ feComponentTransfer: React.SVGProps<SVGFEComponentTransferElement>;
4128
+ feComposite: React.SVGProps<SVGFECompositeElement>;
4129
+ feConvolveMatrix: React.SVGProps<SVGFEConvolveMatrixElement>;
4130
+ feDiffuseLighting: React.SVGProps<SVGFEDiffuseLightingElement>;
4131
+ feDisplacementMap: React.SVGProps<SVGFEDisplacementMapElement>;
4132
+ feDistantLight: React.SVGProps<SVGFEDistantLightElement>;
4133
+ feDropShadow: React.SVGProps<SVGFEDropShadowElement>;
4134
+ feFlood: React.SVGProps<SVGFEFloodElement>;
4135
+ feFuncA: React.SVGProps<SVGFEFuncAElement>;
4136
+ feFuncB: React.SVGProps<SVGFEFuncBElement>;
4137
+ feFuncG: React.SVGProps<SVGFEFuncGElement>;
4138
+ feFuncR: React.SVGProps<SVGFEFuncRElement>;
4139
+ feGaussianBlur: React.SVGProps<SVGFEGaussianBlurElement>;
4140
+ feImage: React.SVGProps<SVGFEImageElement>;
4141
+ feMerge: React.SVGProps<SVGFEMergeElement>;
4142
+ feMergeNode: React.SVGProps<SVGFEMergeNodeElement>;
4143
+ feMorphology: React.SVGProps<SVGFEMorphologyElement>;
4144
+ feOffset: React.SVGProps<SVGFEOffsetElement>;
4145
+ fePointLight: React.SVGProps<SVGFEPointLightElement>;
4146
+ feSpecularLighting: React.SVGProps<SVGFESpecularLightingElement>;
4147
+ feSpotLight: React.SVGProps<SVGFESpotLightElement>;
4148
+ feTile: React.SVGProps<SVGFETileElement>;
4149
+ feTurbulence: React.SVGProps<SVGFETurbulenceElement>;
4150
+ filter: React.SVGProps<SVGFilterElement>;
4151
+ foreignObject: React.SVGProps<SVGForeignObjectElement>;
4152
+ g: React.SVGProps<SVGGElement>;
4153
+ image: React.SVGProps<SVGImageElement>;
4154
+ line: React.SVGLineElementAttributes<SVGLineElement>;
4155
+ linearGradient: React.SVGProps<SVGLinearGradientElement>;
4156
+ marker: React.SVGProps<SVGMarkerElement>;
4157
+ mask: React.SVGProps<SVGMaskElement>;
4158
+ metadata: React.SVGProps<SVGMetadataElement>;
4159
+ mpath: React.SVGProps<SVGElement>;
4160
+ path: React.SVGProps<SVGPathElement>;
4161
+ pattern: React.SVGProps<SVGPatternElement>;
4162
+ polygon: React.SVGProps<SVGPolygonElement>;
4163
+ polyline: React.SVGProps<SVGPolylineElement>;
4164
+ radialGradient: React.SVGProps<SVGRadialGradientElement>;
4165
+ rect: React.SVGProps<SVGRectElement>;
4166
+ set: React.SVGProps<SVGSetElement>;
4167
+ stop: React.SVGProps<SVGStopElement>;
4168
+ switch: React.SVGProps<SVGSwitchElement>;
4169
+ symbol: React.SVGProps<SVGSymbolElement>;
4170
+ text: React.SVGTextElementAttributes<SVGTextElement>;
4171
+ textPath: React.SVGProps<SVGTextPathElement>;
4172
+ tspan: React.SVGProps<SVGTSpanElement>;
4173
+ use: React.SVGProps<SVGUseElement>;
4174
+ view: React.SVGProps<SVGViewElement>;
4175
+ }
4176
+ }
4177
+ }
4178
+
4179
+ type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
4180
+
4181
+ // Any prop that has a default prop becomes optional, but its type is unchanged
4182
+ // Undeclared default props are augmented into the resulting allowable attributes
4183
+ // If declared props have indexed properties, ignore default props entirely as keyof gets widened
4184
+ // Wrap in an outer-level conditional type to allow distribution over props that are unions
4185
+ type Defaultize<P, D> = P extends any ? string extends keyof P ? P
4186
+ :
4187
+ & Pick<P, Exclude<keyof P, keyof D>>
4188
+ & InexactPartial<Pick<P, Extract<keyof P, keyof D>>>
4189
+ & InexactPartial<Pick<D, Exclude<keyof D, keyof P>>>
4190
+ : never;
4191
+
4192
+ type ReactManagedAttributes<C, P> = C extends { defaultProps: infer D } ? Defaultize<P, D>
4193
+ : P;