@types/react 19.1.13 → 19.1.15

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