@cabloy/types-react 19.2.7

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