UNPKG

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