UNPKG

152 kBTypeScriptView Raw
1/// <reference path="global.d.ts" />
2
3import * as CSS from "csstype";
4import * as PropTypes from "prop-types";
5import { Interaction as SchedulerInteraction } from "scheduler/tracing";
6
7type NativeAnimationEvent = AnimationEvent;
8type NativeClipboardEvent = ClipboardEvent;
9type NativeCompositionEvent = CompositionEvent;
10type NativeDragEvent = DragEvent;
11type NativeFocusEvent = FocusEvent;
12type NativeKeyboardEvent = KeyboardEvent;
13type NativeMouseEvent = MouseEvent;
14type NativeTouchEvent = TouchEvent;
15type NativePointerEvent = PointerEvent;
16type NativeTransitionEvent = TransitionEvent;
17type NativeUIEvent = UIEvent;
18type NativeWheelEvent = WheelEvent;
19type Booleanish = boolean | "true" | "false";
20type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined;
21
22declare const UNDEFINED_VOID_ONLY: unique symbol;
23// Destructors are only allowed to return void.
24type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never };
25
26// eslint-disable-next-line @definitelytyped/export-just-namespace
27export = React;
28export as namespace React;
29
30declare namespace React {
31 //
32 // React Elements
33 // ----------------------------------------------------------------------
34
35 type ElementType<P = any> =
36 | {
37 [K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never;
38 }[keyof JSX.IntrinsicElements]
39 | ComponentType<P>;
40 /**
41 * @deprecated Please use `ElementType`
42 */
43 type ReactType<P = any> = ElementType<P>;
44 type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
45
46 type JSXElementConstructor<P> =
47 | ((props: P) => ReactElement<any, any> | null)
48 | (new(props: P) => Component<any, any>);
49
50 interface RefObject<T> {
51 readonly current: T | null;
52 }
53 // Bivariance hack for consistent unsoundness with RefObject
54 type RefCallback<T> = { bivarianceHack(instance: T | null): void }["bivarianceHack"];
55 type Ref<T> = RefCallback<T> | RefObject<T> | null;
56 type LegacyRef<T> = string | Ref<T>;
57 /**
58 * Gets the instance type for a React element. The instance will be different for various component types:
59 *
60 * - React class components will be the class instance. So if you had `class Foo extends React.Component<{}> {}`
61 * and used `React.ElementRef<typeof Foo>` then the type would be the instance of `Foo`.
62 * - React stateless functional components do not have a backing instance and so `React.ElementRef<typeof Bar>`
63 * (when `Bar` is `function Bar() {}`) will give you the `undefined` type.
64 * - JSX intrinsics like `div` will give you their DOM instance. For `React.ElementRef<'div'>` that would be
65 * `HTMLDivElement`. For `React.ElementRef<'input'>` that would be `HTMLInputElement`.
66 * - React stateless functional components that forward a `ref` will give you the `ElementRef` of the forwarded
67 * to component.
68 *
69 * `C` must be the type _of_ a React component so you need to use typeof as in `React.ElementRef<typeof MyComponent>`.
70 *
71 * @todo In Flow, this works a little different with forwarded refs and the `AbstractComponent` that
72 * `React.forwardRef()` returns.
73 */
74 type ElementRef<
75 C extends
76 | ForwardRefExoticComponent<any>
77 | { new(props: any): Component<any> }
78 | ((props: any, context?: any) => ReactElement | null)
79 | keyof JSX.IntrinsicElements,
80 > =
81 // need to check first if `ref` is a valid prop for ts@3.0
82 // otherwise it will infer `{}` instead of `never`
83 "ref" extends keyof ComponentPropsWithRef<C> ? NonNullable<ComponentPropsWithRef<C>["ref"]> extends Ref<
84 infer Instance
85 > ? Instance
86 : never
87 : never;
88
89 type ComponentState = any;
90
91 type Key = string | number;
92
93 /**
94 * @internal You shouldn't need to use this type since you never see these attributes
95 * inside your component or have to validate them.
96 */
97 interface Attributes {
98 key?: Key | null | undefined;
99 }
100 interface RefAttributes<T> extends Attributes {
101 ref?: Ref<T> | undefined;
102 }
103 interface ClassAttributes<T> extends Attributes {
104 ref?: LegacyRef<T> | undefined;
105 }
106
107 interface ReactElement<
108 P = any,
109 T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>,
110 > {
111 type: T;
112 props: P;
113 key: string | null;
114 }
115
116 interface ReactComponentElement<
117 T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>,
118 P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, "key" | "ref">>,
119 > extends ReactElement<P, Exclude<T, number>> {}
120
121 /**
122 * @deprecated Please use `FunctionComponentElement`
123 */
124 type SFCElement<P> = FunctionComponentElement<P>;
125
126 interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
127 ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
128 }
129
130 type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>;
131 interface ComponentElement<P, T extends Component<P, ComponentState>> extends ReactElement<P, ComponentClass<P>> {
132 ref?: LegacyRef<T> | undefined;
133 }
134
135 type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
136
137 // string fallback for custom web-components
138 interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element>
139 extends ReactElement<P, string>
140 {
141 ref: LegacyRef<T>;
142 }
143
144 // ReactHTML for ReactHTMLElement
145 interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {}
146
147 interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> {
148 type: keyof ReactHTML;
149 }
150
151 // ReactSVG for ReactSVGElement
152 interface ReactSVGElement extends DOMElement<SVGAttributes<SVGElement>, SVGElement> {
153 type: keyof ReactSVG;
154 }
155
156 interface ReactPortal extends ReactElement {
157 children: ReactNode;
158 }
159
160 //
161 // Factories
162 // ----------------------------------------------------------------------
163
164 type Factory<P> = (props?: Attributes & P, ...children: ReactNode[]) => ReactElement<P>;
165
166 /**
167 * @deprecated Please use `FunctionComponentFactory`
168 */
169 type SFCFactory<P> = FunctionComponentFactory<P>;
170
171 type FunctionComponentFactory<P> = (
172 props?: Attributes & P,
173 ...children: ReactNode[]
174 ) => FunctionComponentElement<P>;
175
176 type ComponentFactory<P, T extends Component<P, ComponentState>> = (
177 props?: ClassAttributes<T> & P,
178 ...children: ReactNode[]
179 ) => CElement<P, T>;
180
181 type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>;
182 type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>;
183
184 type DOMFactory<P extends DOMAttributes<T>, T extends Element> = (
185 props?: ClassAttributes<T> & P | null,
186 ...children: ReactNode[]
187 ) => DOMElement<P, T>;
188
189 interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {}
190
191 interface DetailedHTMLFactory<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMFactory<P, T> {
192 (props?: ClassAttributes<T> & P | null, ...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
193 }
194
195 interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> {
196 (
197 props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null,
198 ...children: ReactNode[]
199 ): ReactSVGElement;
200 }
201
202 //
203 // React Nodes
204 // ----------------------------------------------------------------------
205
206 type ReactText = string | number;
207 type ReactChild = ReactElement | ReactText;
208
209 /**
210 * @deprecated Use either `ReactNode[]` if you need an array or `Iterable<ReactNode>` if its passed to a host component.
211 */
212 interface ReactNodeArray extends ReadonlyArray<ReactNode> {}
213 type ReactFragment = {} | Iterable<ReactNode>;
214 type ReactNode = ReactChild | ReactFragment | ReactPortal | boolean | null | undefined;
215
216 //
217 // Top Level API
218 // ----------------------------------------------------------------------
219
220 // DOM Elements
221 function createFactory<T extends HTMLElement>(
222 type: keyof ReactHTML,
223 ): HTMLFactory<T>;
224 function createFactory(
225 type: keyof ReactSVG,
226 ): SVGFactory;
227 function createFactory<P extends DOMAttributes<T>, T extends Element>(
228 type: string,
229 ): DOMFactory<P, T>;
230
231 // Custom components
232 function createFactory<P>(type: FunctionComponent<P>): FunctionComponentFactory<P>;
233 function createFactory<P>(
234 type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
235 ): CFactory<P, ClassicComponent<P, ComponentState>>;
236 function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
237 type: ClassType<P, T, C>,
238 ): CFactory<P, T>;
239 function createFactory<P>(type: ComponentClass<P>): Factory<P>;
240
241 // DOM Elements
242 // TODO: generalize this to everything in `keyof ReactHTML`, not just "input"
243 function createElement(
244 type: "input",
245 props?: InputHTMLAttributes<HTMLInputElement> & ClassAttributes<HTMLInputElement> | null,
246 ...children: ReactNode[]
247 ): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
248 function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
249 type: keyof ReactHTML,
250 props?: ClassAttributes<T> & P | null,
251 ...children: ReactNode[]
252 ): DetailedReactHTMLElement<P, T>;
253 function createElement<P extends SVGAttributes<T>, T extends SVGElement>(
254 type: keyof ReactSVG,
255 props?: ClassAttributes<T> & P | null,
256 ...children: ReactNode[]
257 ): ReactSVGElement;
258 function createElement<P extends DOMAttributes<T>, T extends Element>(
259 type: string,
260 props?: ClassAttributes<T> & P | null,
261 ...children: ReactNode[]
262 ): DOMElement<P, T>;
263
264 // Custom components
265
266 function createElement<P extends {}>(
267 type: FunctionComponent<P>,
268 props?: Attributes & P | null,
269 ...children: ReactNode[]
270 ): FunctionComponentElement<P>;
271 function createElement<P extends {}>(
272 type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
273 props?: ClassAttributes<ClassicComponent<P, ComponentState>> & P | null,
274 ...children: ReactNode[]
275 ): CElement<P, ClassicComponent<P, ComponentState>>;
276 function createElement<P extends {}, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
277 type: ClassType<P, T, C>,
278 props?: ClassAttributes<T> & P | null,
279 ...children: ReactNode[]
280 ): CElement<P, T>;
281 function createElement<P extends {}>(
282 type: FunctionComponent<P> | ComponentClass<P> | string,
283 props?: Attributes & P | null,
284 ...children: ReactNode[]
285 ): ReactElement<P>;
286
287 // DOM Elements
288 // ReactHTMLElement
289 function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
290 element: DetailedReactHTMLElement<P, T>,
291 props?: P,
292 ...children: ReactNode[]
293 ): DetailedReactHTMLElement<P, T>;
294 // ReactHTMLElement, less specific
295 function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
296 element: ReactHTMLElement<T>,
297 props?: P,
298 ...children: ReactNode[]
299 ): ReactHTMLElement<T>;
300 // SVGElement
301 function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>(
302 element: ReactSVGElement,
303 props?: P,
304 ...children: ReactNode[]
305 ): ReactSVGElement;
306 // DOM Element (has to be the last, because type checking stops at first overload that fits)
307 function cloneElement<P extends DOMAttributes<T>, T extends Element>(
308 element: DOMElement<P, T>,
309 props?: DOMAttributes<T> & P,
310 ...children: ReactNode[]
311 ): DOMElement<P, T>;
312
313 // Custom components
314 function cloneElement<P>(
315 element: FunctionComponentElement<P>,
316 props?: Partial<P> & Attributes,
317 ...children: ReactNode[]
318 ): FunctionComponentElement<P>;
319 function cloneElement<P, T extends Component<P, ComponentState>>(
320 element: CElement<P, T>,
321 props?: Partial<P> & ClassAttributes<T>,
322 ...children: ReactNode[]
323 ): CElement<P, T>;
324 function cloneElement<P>(
325 element: ReactElement<P>,
326 props?: Partial<P> & Attributes,
327 ...children: ReactNode[]
328 ): ReactElement<P>;
329
330 // Context via RenderProps
331 interface ProviderProps<T> {
332 value: T;
333 children?: ReactNode | undefined;
334 }
335
336 interface ConsumerProps<T> {
337 children: (value: T) => ReactNode;
338 }
339
340 // TODO: similar to how Fragment is actually a symbol, the values returned from createContext,
341 // forwardRef and memo are actually objects that are treated specially by the renderer; see:
342 // https://github.com/facebook/react/blob/v16.6.0/packages/react/src/ReactContext.js#L35-L48
343 // https://github.com/facebook/react/blob/v16.6.0/packages/react/src/forwardRef.js#L42-L45
344 // https://github.com/facebook/react/blob/v16.6.0/packages/react/src/memo.js#L27-L31
345 // However, we have no way of telling the JSX parser that it's a JSX element type or its props other than
346 // by pretending to be a normal component.
347 //
348 // We don't just use ComponentType or FunctionComponent types because you are not supposed to attach statics to this
349 // object, but rather to the original function.
350 interface ExoticComponent<P = {}> {
351 /**
352 * **NOTE**: Exotic components are not callable.
353 */
354 (props: P): ReactElement | null;
355 readonly $$typeof: symbol;
356 }
357
358 interface NamedExoticComponent<P = {}> extends ExoticComponent<P> {
359 displayName?: string | undefined;
360 }
361
362 interface ProviderExoticComponent<P> extends ExoticComponent<P> {
363 propTypes?: WeakValidationMap<P> | undefined;
364 }
365
366 type ContextType<C extends Context<any>> = C extends Context<infer T> ? T : never;
367
368 // NOTE: only the Context object itself can get a displayName
369 // https://github.com/facebook/react-devtools/blob/e0b854e4c/backend/attachRendererFiber.js#L310-L325
370 type Provider<T> = ProviderExoticComponent<ProviderProps<T>>;
371 type Consumer<T> = ExoticComponent<ConsumerProps<T>>;
372 interface Context<T> {
373 Provider: Provider<T>;
374 Consumer: Consumer<T>;
375 displayName?: string | undefined;
376 }
377 function createContext<T>(
378 // If you thought this should be optional, see
379 // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24509#issuecomment-382213106
380 defaultValue: T,
381 ): Context<T>;
382
383 function isValidElement<P>(object: {} | null | undefined): object is ReactElement<P>;
384
385 const Children: ReactChildren;
386 const Fragment: ExoticComponent<{ children?: ReactNode | undefined }>;
387 const StrictMode: ExoticComponent<{ children?: ReactNode | undefined }>;
388
389 interface SuspenseProps {
390 children?: ReactNode | undefined;
391
392 // TODO(react18): `fallback?: ReactNode;`
393 /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */
394 fallback: NonNullable<ReactNode> | null;
395 }
396
397 // TODO(react18): Updated JSDoc to reflect that Suspense works on the server.
398 /**
399 * This feature is not yet available for server-side rendering.
400 * Suspense support will be added in a later release.
401 */
402 const Suspense: ExoticComponent<SuspenseProps>;
403 const version: string;
404
405 /**
406 * {@link https://react.dev/reference/react/Profiler#onrender-callback Profiler API}}
407 */
408 type ProfilerOnRenderCallback = (
409 id: string,
410 phase: "mount" | "update",
411 actualDuration: number,
412 baseDuration: number,
413 startTime: number,
414 commitTime: number,
415 interactions: Set<SchedulerInteraction>,
416 ) => void;
417 interface ProfilerProps {
418 children?: ReactNode | undefined;
419 id: string;
420 onRender: ProfilerOnRenderCallback;
421 }
422
423 const Profiler: ExoticComponent<ProfilerProps>;
424
425 //
426 // Component API
427 // ----------------------------------------------------------------------
428
429 type ReactInstance = Component<any> | Element;
430
431 // Base component for plain JS classes
432 interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {}
433 class Component<P, S> {
434 // tslint won't let me format the sample code in a way that vscode likes it :(
435 /**
436 * If set, `this.context` will be set at runtime to the current value of the given Context.
437 *
438 * Usage:
439 *
440 * ```ts
441 * type MyContext = number
442 * const Ctx = React.createContext<MyContext>(0)
443 *
444 * class Foo extends React.Component {
445 * static contextType = Ctx
446 * context!: React.ContextType<typeof Ctx>
447 * render () {
448 * return <>My context's value: {this.context}</>;
449 * }
450 * }
451 * ```
452 *
453 * @see https://react.dev/reference/react/Component#static-contexttype
454 */
455 static contextType?: Context<any> | undefined;
456
457 /**
458 * If using the new style context, re-declare this in your class to be the
459 * `React.ContextType` of your `static contextType`.
460 * Should be used with type annotation or static contextType.
461 *
462 * ```ts
463 * static contextType = MyContext
464 * // For TS pre-3.7:
465 * context!: React.ContextType<typeof MyContext>
466 * // For TS 3.7 and above:
467 * declare context: React.ContextType<typeof MyContext>
468 * ```
469 *
470 * @see https://react.dev/reference/react/Component#context
471 */
472 // TODO (TypeScript 3.0): unknown
473 context: any;
474
475 constructor(props: Readonly<P> | P);
476 /**
477 * @deprecated
478 * @see https://legacy.reactjs.org/docs/legacy-context.html
479 */
480 constructor(props: P, context: any);
481
482 // We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
483 // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
484 // Also, the ` | S` allows intellisense to not be dumbisense
485 setState<K extends keyof S>(
486 state: ((prevState: Readonly<S>, props: Readonly<P>) => Pick<S, K> | S | null) | (Pick<S, K> | S | null),
487 callback?: () => void,
488 ): void;
489
490 forceUpdate(callback?: () => void): void;
491 render(): ReactNode;
492
493 // React.Props<T> is now deprecated, which means that the `children`
494 // property is not available on `P` by default, even though you can
495 // always pass children as variadic arguments to `createElement`.
496 // In the future, if we can define its call signature conditionally
497 // on the existence of `children` in `P`, then we should remove this.
498 readonly props: Readonly<P> & Readonly<{ children?: ReactNode | undefined }>;
499 state: Readonly<S>;
500 /**
501 * @deprecated
502 * https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs
503 */
504 refs: {
505 [key: string]: ReactInstance;
506 };
507 }
508
509 class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {}
510
511 interface ClassicComponent<P = {}, S = {}> extends Component<P, S> {
512 replaceState(nextState: S, callback?: () => void): void;
513 isMounted(): boolean;
514 getInitialState?(): S;
515 }
516
517 interface ChildContextProvider<CC> {
518 getChildContext(): CC;
519 }
520
521 //
522 // Class Interfaces
523 // ----------------------------------------------------------------------
524
525 /**
526 * @deprecated as of recent React versions, function components can no
527 * longer be considered 'stateless'. Please use `FunctionComponent` instead.
528 *
529 * @see [React Hooks](https://reactjs.org/docs/hooks-intro.html)
530 */
531 type SFC<P = {}> = FunctionComponent<P>;
532
533 /**
534 * @deprecated as of recent React versions, function components can no
535 * longer be considered 'stateless'. Please use `FunctionComponent` instead.
536 *
537 * @see [React Hooks](https://reactjs.org/docs/hooks-intro.html)
538 */
539 type StatelessComponent<P = {}> = FunctionComponent<P>;
540
541 type FC<P = {}> = FunctionComponent<P>;
542
543 interface FunctionComponent<P = {}> {
544 (props: PropsWithChildren<P>, context?: any): ReactElement<any, any> | null;
545 propTypes?: WeakValidationMap<P> | undefined;
546 contextTypes?: ValidationMap<any> | undefined;
547 defaultProps?: Partial<P> | undefined;
548 displayName?: string | undefined;
549 }
550
551 type VFC<P = {}> = VoidFunctionComponent<P>;
552
553 interface VoidFunctionComponent<P = {}> {
554 (props: P, context?: any): ReactElement<any, any> | null;
555 propTypes?: WeakValidationMap<P> | undefined;
556 contextTypes?: ValidationMap<any> | undefined;
557 defaultProps?: Partial<P> | undefined;
558 displayName?: string | undefined;
559 }
560
561 type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null;
562
563 interface ForwardRefRenderFunction<T, P = {}> {
564 (props: PropsWithChildren<P>, ref: ForwardedRef<T>): ReactElement | null;
565 displayName?: string | undefined;
566 // explicit rejected with `never` required due to
567 // https://github.com/microsoft/TypeScript/issues/36826
568 /**
569 * defaultProps are not supported on render functions
570 */
571 defaultProps?: never | undefined;
572 /**
573 * propTypes are not supported on render functions
574 */
575 propTypes?: never | undefined;
576 }
577
578 /**
579 * @deprecated Use ForwardRefRenderFunction. forwardRef doesn't accept a
580 * "real" component.
581 */
582 interface RefForwardingComponent<T, P = {}> extends ForwardRefRenderFunction<T, P> {}
583
584 interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
585 new(props: P, context?: any): Component<P, S>;
586 propTypes?: WeakValidationMap<P> | undefined;
587 contextType?: Context<any> | undefined;
588 contextTypes?: ValidationMap<any> | undefined;
589 childContextTypes?: ValidationMap<any> | undefined;
590 defaultProps?: Partial<P> | undefined;
591 displayName?: string | undefined;
592 }
593
594 interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
595 new(props: P, context?: any): ClassicComponent<P, ComponentState>;
596 getDefaultProps?(): P;
597 }
598
599 /**
600 * We use an intersection type to infer multiple type parameters from
601 * a single argument, which is useful for many top-level API defs.
602 * See https://github.com/Microsoft/TypeScript/issues/7234 for more info.
603 */
604 type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
605 & C
606 & (new(props: P, context?: any) => T);
607
608 //
609 // Component Specs and Lifecycle
610 // ----------------------------------------------------------------------
611
612 // This should actually be something like `Lifecycle<P, S> | DeprecatedLifecycle<P, S>`,
613 // as React will _not_ call the deprecated lifecycle methods if any of the new lifecycle
614 // methods are present.
615 interface ComponentLifecycle<P, S, SS = any> extends NewLifecycle<P, S, SS>, DeprecatedLifecycle<P, S> {
616 /**
617 * Called immediately after a component is mounted. Setting state here will trigger re-rendering.
618 */
619 componentDidMount?(): void;
620 /**
621 * Called to determine whether the change in props and state should trigger a re-render.
622 *
623 * `Component` always returns true.
624 * `PureComponent` implements a shallow comparison on props and state and returns true if any
625 * props or states have changed.
626 *
627 * If false is returned, `Component#render`, `componentWillUpdate`
628 * and `componentDidUpdate` will not be called.
629 */
630 shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean;
631 /**
632 * Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
633 * cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`.
634 */
635 componentWillUnmount?(): void;
636 /**
637 * Catches exceptions generated in descendant components. Unhandled exceptions will cause
638 * the entire component tree to unmount.
639 */
640 componentDidCatch?(error: Error, errorInfo: ErrorInfo): void;
641 }
642
643 // Unfortunately, we have no way of declaring that the component constructor must implement this
644 interface StaticLifecycle<P, S> {
645 getDerivedStateFromProps?: GetDerivedStateFromProps<P, S> | undefined;
646 getDerivedStateFromError?: GetDerivedStateFromError<P, S> | undefined;
647 }
648
649 type GetDerivedStateFromProps<P, S> =
650 /**
651 * Returns an update to a component's state based on its new props and old state.
652 *
653 * Note: its presence prevents any of the deprecated lifecycle methods from being invoked
654 */
655 (nextProps: Readonly<P>, prevState: S) => Partial<S> | null;
656
657 type GetDerivedStateFromError<P, S> =
658 /**
659 * This lifecycle is invoked after an error has been thrown by a descendant component.
660 * It receives the error that was thrown as a parameter and should return a value to update state.
661 *
662 * Note: its presence prevents any of the deprecated lifecycle methods from being invoked
663 */
664 (error: any) => Partial<S> | null;
665
666 // This should be "infer SS" but can't use it yet
667 interface NewLifecycle<P, S, SS> {
668 /**
669 * Runs before React applies the result of `render` to the document, and
670 * returns an object to be given to componentDidUpdate. Useful for saving
671 * things such as scroll position before `render` causes changes to it.
672 *
673 * Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated
674 * lifecycle events from running.
675 */
676 getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>): SS | null;
677 /**
678 * Called immediately after updating occurs. Not called for the initial render.
679 *
680 * The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
681 */
682 componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot?: SS): void;
683 }
684
685 interface DeprecatedLifecycle<P, S> {
686 /**
687 * Called immediately before mounting occurs, and before `Component#render`.
688 * Avoid introducing any side-effects or subscriptions in this method.
689 *
690 * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
691 * prevents this from being invoked.
692 *
693 * @deprecated 16.3, use componentDidMount or the constructor instead; will stop working in React 17
694 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
695 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
696 */
697 componentWillMount?(): void;
698 /**
699 * Called immediately before mounting occurs, and before `Component#render`.
700 * Avoid introducing any side-effects or subscriptions in this method.
701 *
702 * This method will not stop working in React 17.
703 *
704 * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
705 * prevents this from being invoked.
706 *
707 * @deprecated 16.3, use componentDidMount or the constructor instead
708 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
709 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
710 */
711 UNSAFE_componentWillMount?(): void;
712 /**
713 * Called when the component may be receiving new props.
714 * React may call this even if props have not changed, so be sure to compare new and existing
715 * props if you only want to handle changes.
716 *
717 * Calling `Component#setState` generally does not trigger this method.
718 *
719 * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
720 * prevents this from being invoked.
721 *
722 * @deprecated 16.3, use static getDerivedStateFromProps instead; will stop working in React 17
723 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
724 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
725 */
726 componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
727 /**
728 * Called when the component may be receiving new props.
729 * React may call this even if props have not changed, so be sure to compare new and existing
730 * props if you only want to handle changes.
731 *
732 * Calling `Component#setState` generally does not trigger this method.
733 *
734 * This method will not stop working in React 17.
735 *
736 * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
737 * prevents this from being invoked.
738 *
739 * @deprecated 16.3, use static getDerivedStateFromProps instead
740 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
741 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
742 */
743 UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
744 /**
745 * Called immediately before rendering when new props or state is received. Not called for the initial render.
746 *
747 * Note: You cannot call `Component#setState` here.
748 *
749 * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
750 * prevents this from being invoked.
751 *
752 * @deprecated 16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17
753 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
754 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
755 */
756 componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
757 /**
758 * Called immediately before rendering when new props or state is received. Not called for the initial render.
759 *
760 * Note: You cannot call `Component#setState` here.
761 *
762 * This method will not stop working in React 17.
763 *
764 * Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps
765 * prevents this from being invoked.
766 *
767 * @deprecated 16.3, use getSnapshotBeforeUpdate instead
768 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
769 * @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
770 */
771 UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
772 }
773
774 interface Mixin<P, S> extends ComponentLifecycle<P, S> {
775 mixins?: Array<Mixin<P, S>> | undefined;
776 statics?: {
777 [key: string]: any;
778 } | undefined;
779
780 displayName?: string | undefined;
781 propTypes?: ValidationMap<any> | undefined;
782 contextTypes?: ValidationMap<any> | undefined;
783 childContextTypes?: ValidationMap<any> | undefined;
784
785 getDefaultProps?(): P;
786 getInitialState?(): S;
787 }
788
789 interface ComponentSpec<P, S> extends Mixin<P, S> {
790 render(): ReactNode;
791
792 [propertyName: string]: any;
793 }
794
795 function createRef<T>(): RefObject<T>;
796
797 // will show `ForwardRef(${Component.displayName || Component.name})` in devtools by default,
798 // but can be given its own specific name
799 interface ForwardRefExoticComponent<P> extends NamedExoticComponent<P> {
800 defaultProps?: Partial<P> | undefined;
801 propTypes?: WeakValidationMap<P> | undefined;
802 }
803
804 function forwardRef<T, P = {}>(
805 render: ForwardRefRenderFunction<T, P>,
806 ): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
807
808 /** Ensures that the props do not include ref at all */
809 type PropsWithoutRef<P> =
810 // Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
811 // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
812 // https://github.com/Microsoft/TypeScript/issues/28339
813 P extends any ? ("ref" extends keyof P ? Omit<P, "ref"> : P) : P;
814 /** Ensures that the props do not include string ref, which cannot be forwarded */
815 type PropsWithRef<P> =
816 // Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}.
817 "ref" extends keyof P
818 ? P extends { ref?: infer R | undefined }
819 ? string extends R ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
820 : P
821 : P
822 : P;
823
824 type PropsWithChildren<P> = P & { children?: ReactNode | undefined };
825
826 /**
827 * NOTE: prefer ComponentPropsWithRef, if the ref is forwarded,
828 * or ComponentPropsWithoutRef when refs are not supported.
829 */
830 type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends
831 JSXElementConstructor<infer P> ? P
832 : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T]
833 : {};
834 type ComponentPropsWithRef<T extends ElementType> = T extends (new(props: infer P) => Component<any, any>)
835 ? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
836 : PropsWithRef<ComponentProps<T>>;
837 type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;
838
839 type ComponentRef<T extends ElementType> = T extends NamedExoticComponent<
840 ComponentPropsWithoutRef<T> & RefAttributes<infer Method>
841 > ? Method
842 : ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
843 : never;
844
845 // will show `Memo(${Component.displayName || Component.name})` in devtools by default,
846 // but can be given its own specific name
847 type MemoExoticComponent<T extends ComponentType<any>> = NamedExoticComponent<ComponentPropsWithRef<T>> & {
848 readonly type: T;
849 };
850
851 function memo<P extends object>(
852 Component: FunctionComponent<P>,
853 propsAreEqual?: (
854 prevProps: Readonly<PropsWithChildren<P>>,
855 nextProps: Readonly<PropsWithChildren<P>>,
856 ) => boolean,
857 ): NamedExoticComponent<P>;
858 function memo<T extends ComponentType<any>>(
859 Component: T,
860 propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean,
861 ): MemoExoticComponent<T>;
862
863 type LazyExoticComponent<T extends ComponentType<any>> = ExoticComponent<ComponentPropsWithRef<T>> & {
864 readonly _result: T;
865 };
866
867 function lazy<T extends ComponentType<any>>(
868 factory: () => Promise<{ default: T }>,
869 ): LazyExoticComponent<T>;
870
871 //
872 // React Hooks
873 // ----------------------------------------------------------------------
874
875 // based on the code in https://github.com/facebook/react/pull/13968
876
877 // Unlike the class component setState, the updates are not allowed to be partial
878 type SetStateAction<S> = S | ((prevState: S) => S);
879 // this technically does accept a second argument, but it's already under a deprecation warning
880 // and it's not even released so probably better to not define it.
881 type Dispatch<A> = (value: A) => void;
882 // Since action _can_ be undefined, dispatch may be called without any parameters.
883 type DispatchWithoutAction = () => void;
884 // Unlike redux, the actions _can_ be anything
885 type Reducer<S, A> = (prevState: S, action: A) => S;
886 // If useReducer accepts a reducer without action, dispatch may be called without any parameters.
887 type ReducerWithoutAction<S> = (prevState: S) => S;
888 // types used to try and prevent the compiler from reducing S
889 // to a supertype common with the second argument to useReducer()
890 type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
891 type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never;
892 // The identity check is done with the SameValue algorithm (Object.is), which is stricter than ===
893 type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> = R extends ReducerWithoutAction<infer S> ? S
894 : never;
895 // TODO (TypeScript 3.0): ReadonlyArray<unknown>
896 type DependencyList = readonly any[];
897
898 // NOTE: callbacks are _only_ allowed to return either void, or a destructor.
899 type EffectCallback = () => void | Destructor;
900
901 interface MutableRefObject<T> {
902 current: T;
903 }
904
905 // This will technically work if you give a Consumer<T> or Provider<T> but it's deprecated and warns
906 /**
907 * Accepts a context object (the value returned from `React.createContext`) and returns the current
908 * context value, as given by the nearest context provider for the given context.
909 *
910 * @version 16.8.0
911 * @see https://react.dev/reference/react/useContext
912 */
913 function useContext<T>(context: Context<T> /*, (not public API) observedBits?: number|boolean */): T;
914 /**
915 * Returns a stateful value, and a function to update it.
916 *
917 * @version 16.8.0
918 * @see https://react.dev/reference/react/useState
919 */
920 function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>];
921 // convenience overload when first argument is omitted
922 /**
923 * Returns a stateful value, and a function to update it.
924 *
925 * @version 16.8.0
926 * @see https://react.dev/reference/react/useState
927 */
928 function useState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>];
929 /**
930 * An alternative to `useState`.
931 *
932 * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
933 * multiple sub-values. It also lets you optimize performance for components that trigger deep
934 * updates because you can pass `dispatch` down instead of callbacks.
935 *
936 * @version 16.8.0
937 * @see https://react.dev/reference/react/useReducer
938 */
939 // overload where dispatch could accept 0 arguments.
940 function useReducer<R extends ReducerWithoutAction<any>, I>(
941 reducer: R,
942 initializerArg: I,
943 initializer: (arg: I) => ReducerStateWithoutAction<R>,
944 ): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
945 /**
946 * An alternative to `useState`.
947 *
948 * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
949 * multiple sub-values. It also lets you optimize performance for components that trigger deep
950 * updates because you can pass `dispatch` down instead of callbacks.
951 *
952 * @version 16.8.0
953 * @see https://react.dev/reference/react/useReducer
954 */
955 // overload where dispatch could accept 0 arguments.
956 function useReducer<R extends ReducerWithoutAction<any>>(
957 reducer: R,
958 initializerArg: ReducerStateWithoutAction<R>,
959 initializer?: undefined,
960 ): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
961 /**
962 * An alternative to `useState`.
963 *
964 * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
965 * multiple sub-values. It also lets you optimize performance for components that trigger deep
966 * updates because you can pass `dispatch` down instead of callbacks.
967 *
968 * @version 16.8.0
969 * @see https://react.dev/reference/react/useReducer
970 */
971 // overload where "I" may be a subset of ReducerState<R>; used to provide autocompletion.
972 // If "I" matches ReducerState<R> exactly then the last overload will allow initializer to be omitted.
973 // the last overload effectively behaves as if the identity function (x => x) is the initializer.
974 function useReducer<R extends Reducer<any, any>, I>(
975 reducer: R,
976 initializerArg: I & ReducerState<R>,
977 initializer: (arg: I & ReducerState<R>) => ReducerState<R>,
978 ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
979 /**
980 * An alternative to `useState`.
981 *
982 * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
983 * multiple sub-values. It also lets you optimize performance for components that trigger deep
984 * updates because you can pass `dispatch` down instead of callbacks.
985 *
986 * @version 16.8.0
987 * @see https://react.dev/reference/react/useReducer
988 */
989 // overload for free "I"; all goes as long as initializer converts it into "ReducerState<R>".
990 function useReducer<R extends Reducer<any, any>, I>(
991 reducer: R,
992 initializerArg: I,
993 initializer: (arg: I) => ReducerState<R>,
994 ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
995 /**
996 * An alternative to `useState`.
997 *
998 * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
999 * multiple sub-values. It also lets you optimize performance for components that trigger deep
1000 * updates because you can pass `dispatch` down instead of callbacks.
1001 *
1002 * @version 16.8.0
1003 * @see https://react.dev/reference/react/useReducer
1004 */
1005
1006 // I'm not sure if I keep this 2-ary or if I make it (2,3)-ary; it's currently (2,3)-ary.
1007 // The Flow types do have an overload for 3-ary invocation with undefined initializer.
1008
1009 // NOTE: without the ReducerState indirection, TypeScript would reduce S to be the most common
1010 // supertype between the reducer's return type and the initialState (or the initializer's return type),
1011 // which would prevent autocompletion from ever working.
1012
1013 // TODO: double-check if this weird overload logic is necessary. It is possible it's either a bug
1014 // in older versions, or a regression in newer versions of the typescript completion service.
1015 function useReducer<R extends Reducer<any, any>>(
1016 reducer: R,
1017 initialState: ReducerState<R>,
1018 initializer?: undefined,
1019 ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
1020 /**
1021 * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
1022 * (`initialValue`). The returned object will persist for the full lifetime of the component.
1023 *
1024 * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
1025 * value around similar to how you’d use instance fields in classes.
1026 *
1027 * @version 16.8.0
1028 * @see https://react.dev/reference/react/useRef
1029 */
1030 function useRef<T>(initialValue: T): MutableRefObject<T>;
1031 // convenience overload for refs given as a ref prop as they typically start with a null value
1032 /**
1033 * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
1034 * (`initialValue`). The returned object will persist for the full lifetime of the component.
1035 *
1036 * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
1037 * value around similar to how you’d use instance fields in classes.
1038 *
1039 * Usage note: if you need the result of useRef to be directly mutable, include `| null` in the type
1040 * of the generic argument.
1041 *
1042 * @version 16.8.0
1043 * @see https://react.dev/reference/react/useRef
1044 */
1045 function useRef<T>(initialValue: T | null): RefObject<T>;
1046 // convenience overload for potentially undefined initialValue / call with 0 arguments
1047 // has a default to stop it from defaulting to {} instead
1048 /**
1049 * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
1050 * (`initialValue`). The returned object will persist for the full lifetime of the component.
1051 *
1052 * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
1053 * value around similar to how you’d use instance fields in classes.
1054 *
1055 * @version 16.8.0
1056 * @see https://react.dev/reference/react/useRef
1057 */
1058 function useRef<T = undefined>(): MutableRefObject<T | undefined>;
1059 /**
1060 * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations.
1061 * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside
1062 * `useLayoutEffect` will be flushed synchronously, before the browser has a chance to paint.
1063 *
1064 * Prefer the standard `useEffect` when possible to avoid blocking visual updates.
1065 *
1066 * If you’re migrating code from a class component, `useLayoutEffect` fires in the same phase as
1067 * `componentDidMount` and `componentDidUpdate`.
1068 *
1069 * @version 16.8.0
1070 * @see https://react.dev/reference/react/useLayoutEffect
1071 */
1072 function useLayoutEffect(effect: EffectCallback, deps?: DependencyList): void;
1073 /**
1074 * Accepts a function that contains imperative, possibly effectful code.
1075 *
1076 * @param effect Imperative function that can return a cleanup function
1077 * @param deps If present, effect will only activate if the values in the list change.
1078 *
1079 * @version 16.8.0
1080 * @see https://react.dev/reference/react/useEffect
1081 */
1082 function useEffect(effect: EffectCallback, deps?: DependencyList): void;
1083 // NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T>
1084 /**
1085 * `useImperativeHandle` customizes the instance value that is exposed to parent components when using
1086 * `ref`. As always, imperative code using refs should be avoided in most cases.
1087 *
1088 * `useImperativeHandle` should be used with `React.forwardRef`.
1089 *
1090 * @version 16.8.0
1091 * @see https://react.dev/reference/react/useImperativeHandle
1092 */
1093 function useImperativeHandle<T, R extends T>(ref: Ref<T> | undefined, init: () => R, deps?: DependencyList): void;
1094 // I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key
1095 // useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y.
1096 /**
1097 * `useCallback` will return a memoized version of the callback that only changes if one of the `inputs`
1098 * has changed.
1099 *
1100 * @version 16.8.0
1101 * @see https://react.dev/reference/react/useCallback
1102 */
1103 // TODO (TypeScript 3.0): <T extends (...args: never[]) => unknown>
1104 function useCallback<T extends (...args: any[]) => any>(callback: T, deps: DependencyList): T;
1105 /**
1106 * `useMemo` will only recompute the memoized value when one of the `deps` has changed.
1107 *
1108 * @version 16.8.0
1109 * @see https://react.dev/reference/react/useMemo
1110 */
1111 // allow undefined, but don't make it optional as that is very likely a mistake
1112 function useMemo<T>(factory: () => T, deps: DependencyList | undefined): T;
1113 /**
1114 * `useDebugValue` can be used to display a label for custom hooks in React DevTools.
1115 *
1116 * NOTE: We don’t recommend adding debug values to every custom hook.
1117 * It’s most valuable for custom hooks that are part of shared libraries.
1118 *
1119 * @version 16.8.0
1120 * @see https://react.dev/reference/react/useDebugValue
1121 */
1122 // the name of the custom hook is itself derived from the function name at runtime:
1123 // it's just the function name without the "use" prefix.
1124 function useDebugValue<T>(value: T, format?: (value: T) => any): void;
1125
1126 //
1127 // Event System
1128 // ----------------------------------------------------------------------
1129 // TODO: change any to unknown when moving to TS v3
1130 interface BaseSyntheticEvent<E = object, C = any, T = any> {
1131 nativeEvent: E;
1132 currentTarget: C;
1133 target: T;
1134 bubbles: boolean;
1135 cancelable: boolean;
1136 defaultPrevented: boolean;
1137 eventPhase: number;
1138 isTrusted: boolean;
1139 preventDefault(): void;
1140 isDefaultPrevented(): boolean;
1141 stopPropagation(): void;
1142 isPropagationStopped(): boolean;
1143 persist(): void;
1144 timeStamp: number;
1145 type: string;
1146 }
1147
1148 /**
1149 * currentTarget - a reference to the element on which the event listener is registered.
1150 *
1151 * target - a reference to the element from which the event was originally dispatched.
1152 * This might be a child element to the element on which the event listener is registered.
1153 * If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682
1154 */
1155 interface SyntheticEvent<T = Element, E = Event> extends BaseSyntheticEvent<E, EventTarget & T, EventTarget> {}
1156
1157 interface ClipboardEvent<T = Element> extends SyntheticEvent<T, NativeClipboardEvent> {
1158 clipboardData: DataTransfer;
1159 }
1160
1161 interface CompositionEvent<T = Element> extends SyntheticEvent<T, NativeCompositionEvent> {
1162 data: string;
1163 }
1164
1165 interface DragEvent<T = Element> extends MouseEvent<T, NativeDragEvent> {
1166 dataTransfer: DataTransfer;
1167 }
1168
1169 interface PointerEvent<T = Element> extends MouseEvent<T, NativePointerEvent> {
1170 pointerId: number;
1171 pressure: number;
1172 tangentialPressure: number;
1173 tiltX: number;
1174 tiltY: number;
1175 twist: number;
1176 width: number;
1177 height: number;
1178 pointerType: "mouse" | "pen" | "touch";
1179 isPrimary: boolean;
1180 }
1181
1182 interface FocusEvent<Target = Element, RelatedTarget = Element> extends SyntheticEvent<Target, NativeFocusEvent> {
1183 relatedTarget: (EventTarget & RelatedTarget) | null;
1184 target: EventTarget & Target;
1185 }
1186
1187 interface FormEvent<T = Element> extends SyntheticEvent<T> {
1188 }
1189
1190 interface InvalidEvent<T = Element> extends SyntheticEvent<T> {
1191 target: EventTarget & T;
1192 }
1193
1194 interface ChangeEvent<T = Element> extends SyntheticEvent<T> {
1195 target: EventTarget & T;
1196 }
1197
1198 export type ModifierKey =
1199 | "Alt"
1200 | "AltGraph"
1201 | "CapsLock"
1202 | "Control"
1203 | "Fn"
1204 | "FnLock"
1205 | "Hyper"
1206 | "Meta"
1207 | "NumLock"
1208 | "ScrollLock"
1209 | "Shift"
1210 | "Super"
1211 | "Symbol"
1212 | "SymbolLock";
1213
1214 interface KeyboardEvent<T = Element> extends UIEvent<T, NativeKeyboardEvent> {
1215 altKey: boolean;
1216 /** @deprecated */
1217 charCode: number;
1218 ctrlKey: boolean;
1219 code: string;
1220 /**
1221 * 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.
1222 */
1223 getModifierState(key: ModifierKey): boolean;
1224 /**
1225 * See the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values). for possible values
1226 */
1227 key: string;
1228 /** @deprecated */
1229 keyCode: number;
1230 locale: string;
1231 location: number;
1232 metaKey: boolean;
1233 repeat: boolean;
1234 shiftKey: boolean;
1235 /** @deprecated */
1236 which: number;
1237 }
1238
1239 interface MouseEvent<T = Element, E = NativeMouseEvent> extends UIEvent<T, E> {
1240 altKey: boolean;
1241 button: number;
1242 buttons: number;
1243 clientX: number;
1244 clientY: number;
1245 ctrlKey: boolean;
1246 /**
1247 * 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.
1248 */
1249 getModifierState(key: ModifierKey): boolean;
1250 metaKey: boolean;
1251 movementX: number;
1252 movementY: number;
1253 pageX: number;
1254 pageY: number;
1255 relatedTarget: EventTarget | null;
1256 screenX: number;
1257 screenY: number;
1258 shiftKey: boolean;
1259 }
1260
1261 interface TouchEvent<T = Element> extends UIEvent<T, NativeTouchEvent> {
1262 altKey: boolean;
1263 changedTouches: TouchList;
1264 ctrlKey: boolean;
1265 /**
1266 * 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.
1267 */
1268 getModifierState(key: ModifierKey): boolean;
1269 metaKey: boolean;
1270 shiftKey: boolean;
1271 targetTouches: TouchList;
1272 touches: TouchList;
1273 }
1274
1275 interface UIEvent<T = Element, E = NativeUIEvent> extends SyntheticEvent<T, E> {
1276 detail: number;
1277 view: AbstractView;
1278 }
1279
1280 interface WheelEvent<T = Element> extends MouseEvent<T, NativeWheelEvent> {
1281 deltaMode: number;
1282 deltaX: number;
1283 deltaY: number;
1284 deltaZ: number;
1285 }
1286
1287 interface AnimationEvent<T = Element> extends SyntheticEvent<T, NativeAnimationEvent> {
1288 animationName: string;
1289 elapsedTime: number;
1290 pseudoElement: string;
1291 }
1292
1293 interface TransitionEvent<T = Element> extends SyntheticEvent<T, NativeTransitionEvent> {
1294 elapsedTime: number;
1295 propertyName: string;
1296 pseudoElement: string;
1297 }
1298
1299 //
1300 // Event Handler Types
1301 // ----------------------------------------------------------------------
1302
1303 type EventHandler<E extends SyntheticEvent<any>> = { bivarianceHack(event: E): void }["bivarianceHack"];
1304
1305 type ReactEventHandler<T = Element> = EventHandler<SyntheticEvent<T>>;
1306
1307 type ClipboardEventHandler<T = Element> = EventHandler<ClipboardEvent<T>>;
1308 type CompositionEventHandler<T = Element> = EventHandler<CompositionEvent<T>>;
1309 type DragEventHandler<T = Element> = EventHandler<DragEvent<T>>;
1310 type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
1311 type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
1312 type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
1313 type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
1314 type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
1315 type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
1316 type PointerEventHandler<T = Element> = EventHandler<PointerEvent<T>>;
1317 type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>;
1318 type WheelEventHandler<T = Element> = EventHandler<WheelEvent<T>>;
1319 type AnimationEventHandler<T = Element> = EventHandler<AnimationEvent<T>>;
1320 type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent<T>>;
1321
1322 //
1323 // Props / DOM Attributes
1324 // ----------------------------------------------------------------------
1325
1326 /**
1327 * @deprecated This was used to allow clients to pass `ref` and `key`
1328 * to `createElement`, which is no longer necessary due to intersection
1329 * types. If you need to declare a props object before passing it to
1330 * `createElement` or a factory, use `ClassAttributes<T>`:
1331 *
1332 * ```ts
1333 * var b: Button | null;
1334 * var props: ButtonProps & ClassAttributes<Button> = {
1335 * ref: b => button = b, // ok!
1336 * label: "I'm a Button"
1337 * };
1338 * ```
1339 */
1340 interface Props<T> {
1341 children?: ReactNode | undefined;
1342 key?: Key | undefined;
1343 ref?: LegacyRef<T> | undefined;
1344 }
1345
1346 interface HTMLProps<T> extends AllHTMLAttributes<T>, ClassAttributes<T> {
1347 }
1348
1349 type DetailedHTMLProps<E extends HTMLAttributes<T>, T> = ClassAttributes<T> & E;
1350
1351 interface SVGProps<T> extends SVGAttributes<T>, ClassAttributes<T> {
1352 }
1353
1354 interface SVGLineElementAttributes<T> extends SVGProps<T> {}
1355 interface SVGTextElementAttributes<T> extends SVGProps<T> {}
1356
1357 interface DOMAttributes<T> {
1358 children?: ReactNode | undefined;
1359 dangerouslySetInnerHTML?: {
1360 // Should be InnerHTML['innerHTML'].
1361 // But unfortunately we're mixing renderer-specific type declarations.
1362 __html: string | TrustedHTML;
1363 } | undefined;
1364
1365 // Clipboard Events
1366 onCopy?: ClipboardEventHandler<T> | undefined;
1367 onCopyCapture?: ClipboardEventHandler<T> | undefined;
1368 onCut?: ClipboardEventHandler<T> | undefined;
1369 onCutCapture?: ClipboardEventHandler<T> | undefined;
1370 onPaste?: ClipboardEventHandler<T> | undefined;
1371 onPasteCapture?: ClipboardEventHandler<T> | undefined;
1372
1373 // Composition Events
1374 onCompositionEnd?: CompositionEventHandler<T> | undefined;
1375 onCompositionEndCapture?: CompositionEventHandler<T> | undefined;
1376 onCompositionStart?: CompositionEventHandler<T> | undefined;
1377 onCompositionStartCapture?: CompositionEventHandler<T> | undefined;
1378 onCompositionUpdate?: CompositionEventHandler<T> | undefined;
1379 onCompositionUpdateCapture?: CompositionEventHandler<T> | undefined;
1380
1381 // Focus Events
1382 onFocus?: FocusEventHandler<T> | undefined;
1383 onFocusCapture?: FocusEventHandler<T> | undefined;
1384 onBlur?: FocusEventHandler<T> | undefined;
1385 onBlurCapture?: FocusEventHandler<T> | undefined;
1386
1387 // Form Events
1388 onChange?: FormEventHandler<T> | undefined;
1389 onChangeCapture?: FormEventHandler<T> | undefined;
1390 onBeforeInput?: FormEventHandler<T> | undefined;
1391 onBeforeInputCapture?: FormEventHandler<T> | undefined;
1392 onInput?: FormEventHandler<T> | undefined;
1393 onInputCapture?: FormEventHandler<T> | undefined;
1394 onReset?: FormEventHandler<T> | undefined;
1395 onResetCapture?: FormEventHandler<T> | undefined;
1396 onSubmit?: FormEventHandler<T> | undefined;
1397 onSubmitCapture?: FormEventHandler<T> | undefined;
1398 onInvalid?: FormEventHandler<T> | undefined;
1399 onInvalidCapture?: FormEventHandler<T> | undefined;
1400
1401 // Image Events
1402 onLoad?: ReactEventHandler<T> | undefined;
1403 onLoadCapture?: ReactEventHandler<T> | undefined;
1404 onError?: ReactEventHandler<T> | undefined; // also a Media Event
1405 onErrorCapture?: ReactEventHandler<T> | undefined; // also a Media Event
1406
1407 // Keyboard Events
1408 onKeyDown?: KeyboardEventHandler<T> | undefined;
1409 onKeyDownCapture?: KeyboardEventHandler<T> | undefined;
1410 /** @deprecated */
1411 onKeyPress?: KeyboardEventHandler<T> | undefined;
1412 /** @deprecated */
1413 onKeyPressCapture?: KeyboardEventHandler<T> | undefined;
1414 onKeyUp?: KeyboardEventHandler<T> | undefined;
1415 onKeyUpCapture?: KeyboardEventHandler<T> | undefined;
1416
1417 // Media Events
1418 onAbort?: ReactEventHandler<T> | undefined;
1419 onAbortCapture?: ReactEventHandler<T> | undefined;
1420 onCanPlay?: ReactEventHandler<T> | undefined;
1421 onCanPlayCapture?: ReactEventHandler<T> | undefined;
1422 onCanPlayThrough?: ReactEventHandler<T> | undefined;
1423 onCanPlayThroughCapture?: ReactEventHandler<T> | undefined;
1424 onDurationChange?: ReactEventHandler<T> | undefined;
1425 onDurationChangeCapture?: ReactEventHandler<T> | undefined;
1426 onEmptied?: ReactEventHandler<T> | undefined;
1427 onEmptiedCapture?: ReactEventHandler<T> | undefined;
1428 onEncrypted?: ReactEventHandler<T> | undefined;
1429 onEncryptedCapture?: ReactEventHandler<T> | undefined;
1430 onEnded?: ReactEventHandler<T> | undefined;
1431 onEndedCapture?: ReactEventHandler<T> | undefined;
1432 onLoadedData?: ReactEventHandler<T> | undefined;
1433 onLoadedDataCapture?: ReactEventHandler<T> | undefined;
1434 onLoadedMetadata?: ReactEventHandler<T> | undefined;
1435 onLoadedMetadataCapture?: ReactEventHandler<T> | undefined;
1436 onLoadStart?: ReactEventHandler<T> | undefined;
1437 onLoadStartCapture?: ReactEventHandler<T> | undefined;
1438 onPause?: ReactEventHandler<T> | undefined;
1439 onPauseCapture?: ReactEventHandler<T> | undefined;
1440 onPlay?: ReactEventHandler<T> | undefined;
1441 onPlayCapture?: ReactEventHandler<T> | undefined;
1442 onPlaying?: ReactEventHandler<T> | undefined;
1443 onPlayingCapture?: ReactEventHandler<T> | undefined;
1444 onProgress?: ReactEventHandler<T> | undefined;
1445 onProgressCapture?: ReactEventHandler<T> | undefined;
1446 onRateChange?: ReactEventHandler<T> | undefined;
1447 onRateChangeCapture?: ReactEventHandler<T> | undefined;
1448 onSeeked?: ReactEventHandler<T> | undefined;
1449 onSeekedCapture?: ReactEventHandler<T> | undefined;
1450 onSeeking?: ReactEventHandler<T> | undefined;
1451 onSeekingCapture?: ReactEventHandler<T> | undefined;
1452 onStalled?: ReactEventHandler<T> | undefined;
1453 onStalledCapture?: ReactEventHandler<T> | undefined;
1454 onSuspend?: ReactEventHandler<T> | undefined;
1455 onSuspendCapture?: ReactEventHandler<T> | undefined;
1456 onTimeUpdate?: ReactEventHandler<T> | undefined;
1457 onTimeUpdateCapture?: ReactEventHandler<T> | undefined;
1458 onVolumeChange?: ReactEventHandler<T> | undefined;
1459 onVolumeChangeCapture?: ReactEventHandler<T> | undefined;
1460 onWaiting?: ReactEventHandler<T> | undefined;
1461 onWaitingCapture?: ReactEventHandler<T> | undefined;
1462
1463 // MouseEvents
1464 onAuxClick?: MouseEventHandler<T> | undefined;
1465 onAuxClickCapture?: MouseEventHandler<T> | undefined;
1466 onClick?: MouseEventHandler<T> | undefined;
1467 onClickCapture?: MouseEventHandler<T> | undefined;
1468 onContextMenu?: MouseEventHandler<T> | undefined;
1469 onContextMenuCapture?: MouseEventHandler<T> | undefined;
1470 onDoubleClick?: MouseEventHandler<T> | undefined;
1471 onDoubleClickCapture?: MouseEventHandler<T> | undefined;
1472 onDrag?: DragEventHandler<T> | undefined;
1473 onDragCapture?: DragEventHandler<T> | undefined;
1474 onDragEnd?: DragEventHandler<T> | undefined;
1475 onDragEndCapture?: DragEventHandler<T> | undefined;
1476 onDragEnter?: DragEventHandler<T> | undefined;
1477 onDragEnterCapture?: DragEventHandler<T> | undefined;
1478 onDragExit?: DragEventHandler<T> | undefined;
1479 onDragExitCapture?: DragEventHandler<T> | undefined;
1480 onDragLeave?: DragEventHandler<T> | undefined;
1481 onDragLeaveCapture?: DragEventHandler<T> | undefined;
1482 onDragOver?: DragEventHandler<T> | undefined;
1483 onDragOverCapture?: DragEventHandler<T> | undefined;
1484 onDragStart?: DragEventHandler<T> | undefined;
1485 onDragStartCapture?: DragEventHandler<T> | undefined;
1486 onDrop?: DragEventHandler<T> | undefined;
1487 onDropCapture?: DragEventHandler<T> | undefined;
1488 onMouseDown?: MouseEventHandler<T> | undefined;
1489 onMouseDownCapture?: MouseEventHandler<T> | undefined;
1490 onMouseEnter?: MouseEventHandler<T> | undefined;
1491 onMouseLeave?: MouseEventHandler<T> | undefined;
1492 onMouseMove?: MouseEventHandler<T> | undefined;
1493 onMouseMoveCapture?: MouseEventHandler<T> | undefined;
1494 onMouseOut?: MouseEventHandler<T> | undefined;
1495 onMouseOutCapture?: MouseEventHandler<T> | undefined;
1496 onMouseOver?: MouseEventHandler<T> | undefined;
1497 onMouseOverCapture?: MouseEventHandler<T> | undefined;
1498 onMouseUp?: MouseEventHandler<T> | undefined;
1499 onMouseUpCapture?: MouseEventHandler<T> | undefined;
1500
1501 // Selection Events
1502 onSelect?: ReactEventHandler<T> | undefined;
1503 onSelectCapture?: ReactEventHandler<T> | undefined;
1504
1505 // Touch Events
1506 onTouchCancel?: TouchEventHandler<T> | undefined;
1507 onTouchCancelCapture?: TouchEventHandler<T> | undefined;
1508 onTouchEnd?: TouchEventHandler<T> | undefined;
1509 onTouchEndCapture?: TouchEventHandler<T> | undefined;
1510 onTouchMove?: TouchEventHandler<T> | undefined;
1511 onTouchMoveCapture?: TouchEventHandler<T> | undefined;
1512 onTouchStart?: TouchEventHandler<T> | undefined;
1513 onTouchStartCapture?: TouchEventHandler<T> | undefined;
1514
1515 // Pointer Events
1516 onPointerDown?: PointerEventHandler<T> | undefined;
1517 onPointerDownCapture?: PointerEventHandler<T> | undefined;
1518 onPointerMove?: PointerEventHandler<T> | undefined;
1519 onPointerMoveCapture?: PointerEventHandler<T> | undefined;
1520 onPointerUp?: PointerEventHandler<T> | undefined;
1521 onPointerUpCapture?: PointerEventHandler<T> | undefined;
1522 onPointerCancel?: PointerEventHandler<T> | undefined;
1523 onPointerCancelCapture?: PointerEventHandler<T> | undefined;
1524 onPointerEnter?: PointerEventHandler<T> | undefined;
1525 /**
1526 * @deprecated This event handler was always ignored by React. It was added by mistake to the types.
1527 */
1528 // Removing this breaks too many libraries to be worth it.
1529 onPointerEnterCapture?: PointerEventHandler<T> | undefined;
1530 onPointerLeave?: PointerEventHandler<T> | undefined;
1531 /**
1532 * @deprecated This event handler was always ignored by React. It was added by mistake to the types.
1533 */
1534 // Removing this breaks too many libraries to be worth it.
1535 onPointerLeaveCapture?: PointerEventHandler<T> | undefined;
1536 onPointerOver?: PointerEventHandler<T> | undefined;
1537 onPointerOverCapture?: PointerEventHandler<T> | undefined;
1538 onPointerOut?: PointerEventHandler<T> | undefined;
1539 onPointerOutCapture?: PointerEventHandler<T> | undefined;
1540 onGotPointerCapture?: PointerEventHandler<T> | undefined;
1541 onGotPointerCaptureCapture?: PointerEventHandler<T> | undefined;
1542 onLostPointerCapture?: PointerEventHandler<T> | undefined;
1543 onLostPointerCaptureCapture?: PointerEventHandler<T> | undefined;
1544
1545 // UI Events
1546 onScroll?: UIEventHandler<T> | undefined;
1547 onScrollCapture?: UIEventHandler<T> | undefined;
1548
1549 // Wheel Events
1550 onWheel?: WheelEventHandler<T> | undefined;
1551 onWheelCapture?: WheelEventHandler<T> | undefined;
1552
1553 // Animation Events
1554 onAnimationStart?: AnimationEventHandler<T> | undefined;
1555 onAnimationStartCapture?: AnimationEventHandler<T> | undefined;
1556 onAnimationEnd?: AnimationEventHandler<T> | undefined;
1557 onAnimationEndCapture?: AnimationEventHandler<T> | undefined;
1558 onAnimationIteration?: AnimationEventHandler<T> | undefined;
1559 onAnimationIterationCapture?: AnimationEventHandler<T> | undefined;
1560
1561 // Transition Events
1562 onTransitionEnd?: TransitionEventHandler<T> | undefined;
1563 onTransitionEndCapture?: TransitionEventHandler<T> | undefined;
1564 }
1565
1566 export interface CSSProperties extends CSS.Properties<string | number> {
1567 /**
1568 * The index signature was removed to enable closed typing for style
1569 * using CSSType. You're able to use type assertion or module augmentation
1570 * to add properties or an index signature of your own.
1571 *
1572 * For examples and more information, visit:
1573 * https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors
1574 */
1575 }
1576
1577 // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/
1578 interface AriaAttributes {
1579 /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */
1580 "aria-activedescendant"?: string | undefined;
1581 /** 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. */
1582 "aria-atomic"?: Booleanish | undefined;
1583 /**
1584 * 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
1585 * presented if they are made.
1586 */
1587 "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
1588 /** 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. */
1589 "aria-busy"?: Booleanish | undefined;
1590 /**
1591 * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
1592 * @see aria-pressed @see aria-selected.
1593 */
1594 "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
1595 /**
1596 * Defines the total number of columns in a table, grid, or treegrid.
1597 * @see aria-colindex.
1598 */
1599 "aria-colcount"?: number | undefined;
1600 /**
1601 * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
1602 * @see aria-colcount @see aria-colspan.
1603 */
1604 "aria-colindex"?: number | undefined;
1605 /**
1606 * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
1607 * @see aria-colindex @see aria-rowspan.
1608 */
1609 "aria-colspan"?: number | undefined;
1610 /**
1611 * Identifies the element (or elements) whose contents or presence are controlled by the current element.
1612 * @see aria-owns.
1613 */
1614 "aria-controls"?: string | undefined;
1615 /** Indicates the element that represents the current item within a container or set of related elements. */
1616 "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
1617 /**
1618 * Identifies the element (or elements) that describes the object.
1619 * @see aria-labelledby
1620 */
1621 "aria-describedby"?: string | undefined;
1622 /**
1623 * Identifies the element that provides a detailed, extended description for the object.
1624 * @see aria-describedby.
1625 */
1626 "aria-details"?: string | undefined;
1627 /**
1628 * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
1629 * @see aria-hidden @see aria-readonly.
1630 */
1631 "aria-disabled"?: Booleanish | undefined;
1632 /**
1633 * Indicates what functions can be performed when a dragged object is released on the drop target.
1634 * @deprecated in ARIA 1.1
1635 */
1636 "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
1637 /**
1638 * Identifies the element that provides an error message for the object.
1639 * @see aria-invalid @see aria-describedby.
1640 */
1641 "aria-errormessage"?: string | undefined;
1642 /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */
1643 "aria-expanded"?: Booleanish | undefined;
1644 /**
1645 * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,
1646 * allows assistive technology to override the general default of reading in document source order.
1647 */
1648 "aria-flowto"?: string | undefined;
1649 /**
1650 * Indicates an element's "grabbed" state in a drag-and-drop operation.
1651 * @deprecated in ARIA 1.1
1652 */
1653 "aria-grabbed"?: Booleanish | undefined;
1654 /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */
1655 "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
1656 /**
1657 * Indicates whether the element is exposed to an accessibility API.
1658 * @see aria-disabled.
1659 */
1660 "aria-hidden"?: Booleanish | undefined;
1661 /**
1662 * Indicates the entered value does not conform to the format expected by the application.
1663 * @see aria-errormessage.
1664 */
1665 "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
1666 /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */
1667 "aria-keyshortcuts"?: string | undefined;
1668 /**
1669 * Defines a string value that labels the current element.
1670 * @see aria-labelledby.
1671 */
1672 "aria-label"?: string | undefined;
1673 /**
1674 * Identifies the element (or elements) that labels the current element.
1675 * @see aria-describedby.
1676 */
1677 "aria-labelledby"?: string | undefined;
1678 /** Defines the hierarchical level of an element within a structure. */
1679 "aria-level"?: number | undefined;
1680 /** 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. */
1681 "aria-live"?: "off" | "assertive" | "polite" | undefined;
1682 /** Indicates whether an element is modal when displayed. */
1683 "aria-modal"?: Booleanish | undefined;
1684 /** Indicates whether a text box accepts multiple lines of input or only a single line. */
1685 "aria-multiline"?: Booleanish | undefined;
1686 /** Indicates that the user may select more than one item from the current selectable descendants. */
1687 "aria-multiselectable"?: Booleanish | undefined;
1688 /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */
1689 "aria-orientation"?: "horizontal" | "vertical" | undefined;
1690 /**
1691 * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship
1692 * between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
1693 * @see aria-controls.
1694 */
1695 "aria-owns"?: string | undefined;
1696 /**
1697 * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.
1698 * A hint could be a sample value or a brief description of the expected format.
1699 */
1700 "aria-placeholder"?: string | undefined;
1701 /**
1702 * 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.
1703 * @see aria-setsize.
1704 */
1705 "aria-posinset"?: number | undefined;
1706 /**
1707 * Indicates the current "pressed" state of toggle buttons.
1708 * @see aria-checked @see aria-selected.
1709 */
1710 "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
1711 /**
1712 * Indicates that the element is not editable, but is otherwise operable.
1713 * @see aria-disabled.
1714 */
1715 "aria-readonly"?: Booleanish | undefined;
1716 /**
1717 * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
1718 * @see aria-atomic.
1719 */
1720 "aria-relevant"?:
1721 | "additions"
1722 | "additions removals"
1723 | "additions text"
1724 | "all"
1725 | "removals"
1726 | "removals additions"
1727 | "removals text"
1728 | "text"
1729 | "text additions"
1730 | "text removals"
1731 | undefined;
1732 /** Indicates that user input is required on the element before a form may be submitted. */
1733 "aria-required"?: Booleanish | undefined;
1734 /** Defines a human-readable, author-localized description for the role of an element. */
1735 "aria-roledescription"?: string | undefined;
1736 /**
1737 * Defines the total number of rows in a table, grid, or treegrid.
1738 * @see aria-rowindex.
1739 */
1740 "aria-rowcount"?: number | undefined;
1741 /**
1742 * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
1743 * @see aria-rowcount @see aria-rowspan.
1744 */
1745 "aria-rowindex"?: number | undefined;
1746 /**
1747 * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
1748 * @see aria-rowindex @see aria-colspan.
1749 */
1750 "aria-rowspan"?: number | undefined;
1751 /**
1752 * Indicates the current "selected" state of various widgets.
1753 * @see aria-checked @see aria-pressed.
1754 */
1755 "aria-selected"?: Booleanish | undefined;
1756 /**
1757 * 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.
1758 * @see aria-posinset.
1759 */
1760 "aria-setsize"?: number | undefined;
1761 /** Indicates if items in a table or grid are sorted in ascending or descending order. */
1762 "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
1763 /** Defines the maximum allowed value for a range widget. */
1764 "aria-valuemax"?: number | undefined;
1765 /** Defines the minimum allowed value for a range widget. */
1766 "aria-valuemin"?: number | undefined;
1767 /**
1768 * Defines the current value for a range widget.
1769 * @see aria-valuetext.
1770 */
1771 "aria-valuenow"?: number | undefined;
1772 /** Defines the human readable text alternative of aria-valuenow for a range widget. */
1773 "aria-valuetext"?: string | undefined;
1774 }
1775
1776 // All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions
1777 type AriaRole =
1778 | "alert"
1779 | "alertdialog"
1780 | "application"
1781 | "article"
1782 | "banner"
1783 | "button"
1784 | "cell"
1785 | "checkbox"
1786 | "columnheader"
1787 | "combobox"
1788 | "complementary"
1789 | "contentinfo"
1790 | "definition"
1791 | "dialog"
1792 | "directory"
1793 | "document"
1794 | "feed"
1795 | "figure"
1796 | "form"
1797 | "grid"
1798 | "gridcell"
1799 | "group"
1800 | "heading"
1801 | "img"
1802 | "link"
1803 | "list"
1804 | "listbox"
1805 | "listitem"
1806 | "log"
1807 | "main"
1808 | "marquee"
1809 | "math"
1810 | "menu"
1811 | "menubar"
1812 | "menuitem"
1813 | "menuitemcheckbox"
1814 | "menuitemradio"
1815 | "navigation"
1816 | "none"
1817 | "note"
1818 | "option"
1819 | "presentation"
1820 | "progressbar"
1821 | "radio"
1822 | "radiogroup"
1823 | "region"
1824 | "row"
1825 | "rowgroup"
1826 | "rowheader"
1827 | "scrollbar"
1828 | "search"
1829 | "searchbox"
1830 | "separator"
1831 | "slider"
1832 | "spinbutton"
1833 | "status"
1834 | "switch"
1835 | "tab"
1836 | "table"
1837 | "tablist"
1838 | "tabpanel"
1839 | "term"
1840 | "textbox"
1841 | "timer"
1842 | "toolbar"
1843 | "tooltip"
1844 | "tree"
1845 | "treegrid"
1846 | "treeitem"
1847 | (string & {});
1848
1849 interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
1850 // React-specific Attributes
1851 defaultChecked?: boolean | undefined;
1852 defaultValue?: string | number | readonly string[] | undefined;
1853 suppressContentEditableWarning?: boolean | undefined;
1854 suppressHydrationWarning?: boolean | undefined;
1855
1856 // Standard HTML Attributes
1857 accessKey?: string | undefined;
1858 autoFocus?: boolean | undefined;
1859 className?: string | undefined;
1860 contentEditable?: Booleanish | "inherit" | undefined;
1861 contextMenu?: string | undefined;
1862 dir?: string | undefined;
1863 draggable?: Booleanish | undefined;
1864 hidden?: boolean | undefined;
1865 id?: string | undefined;
1866 lang?: string | undefined;
1867 nonce?: string | undefined;
1868 placeholder?: string | undefined;
1869 slot?: string | undefined;
1870 spellCheck?: Booleanish | undefined;
1871 style?: CSSProperties | undefined;
1872 tabIndex?: number | undefined;
1873 title?: string | undefined;
1874 translate?: "yes" | "no" | undefined;
1875
1876 // Unknown
1877 radioGroup?: string | undefined; // <command>, <menuitem>
1878
1879 // WAI-ARIA
1880 role?: AriaRole | undefined;
1881
1882 // RDFa Attributes
1883 about?: string | undefined;
1884 content?: string | undefined;
1885 datatype?: string | undefined;
1886 inlist?: any;
1887 prefix?: string | undefined;
1888 property?: string | undefined;
1889 rel?: string | undefined;
1890 resource?: string | undefined;
1891 rev?: string | undefined;
1892 typeof?: string | undefined;
1893 vocab?: string | undefined;
1894
1895 // Non-standard Attributes
1896 autoCapitalize?: string | undefined;
1897 autoCorrect?: string | undefined;
1898 autoSave?: string | undefined;
1899 color?: string | undefined;
1900 itemProp?: string | undefined;
1901 itemScope?: boolean | undefined;
1902 itemType?: string | undefined;
1903 itemID?: string | undefined;
1904 itemRef?: string | undefined;
1905 results?: number | undefined;
1906 security?: string | undefined;
1907 unselectable?: "on" | "off" | undefined;
1908
1909 // Living Standard
1910 /**
1911 * Hints at the type of data that might be entered by the user while editing the element or its contents
1912 * @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute
1913 */
1914 inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
1915 /**
1916 * Specify that a standard HTML element should behave like a defined custom built-in element
1917 * @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is
1918 */
1919 is?: string | undefined;
1920 }
1921
1922 interface AllHTMLAttributes<T> extends HTMLAttributes<T> {
1923 // Standard HTML Attributes
1924 accept?: string | undefined;
1925 acceptCharset?: string | undefined;
1926 action?: string | undefined;
1927 allowFullScreen?: boolean | undefined;
1928 allowTransparency?: boolean | undefined;
1929 alt?: string | undefined;
1930 as?: string | undefined;
1931 async?: boolean | undefined;
1932 autoComplete?: string | undefined;
1933 autoPlay?: boolean | undefined;
1934 capture?: boolean | "user" | "environment" | undefined;
1935 cellPadding?: number | string | undefined;
1936 cellSpacing?: number | string | undefined;
1937 charSet?: string | undefined;
1938 challenge?: string | undefined;
1939 checked?: boolean | undefined;
1940 cite?: string | undefined;
1941 classID?: string | undefined;
1942 cols?: number | undefined;
1943 colSpan?: number | undefined;
1944 controls?: boolean | undefined;
1945 coords?: string | undefined;
1946 crossOrigin?: CrossOrigin;
1947 data?: string | undefined;
1948 dateTime?: string | undefined;
1949 default?: boolean | undefined;
1950 defer?: boolean | undefined;
1951 disabled?: boolean | undefined;
1952 download?: any;
1953 encType?: string | undefined;
1954 form?: string | undefined;
1955 formAction?: string | undefined;
1956 formEncType?: string | undefined;
1957 formMethod?: string | undefined;
1958 formNoValidate?: boolean | undefined;
1959 formTarget?: string | undefined;
1960 frameBorder?: number | string | undefined;
1961 headers?: string | undefined;
1962 height?: number | string | undefined;
1963 high?: number | undefined;
1964 href?: string | undefined;
1965 hrefLang?: string | undefined;
1966 htmlFor?: string | undefined;
1967 httpEquiv?: string | undefined;
1968 integrity?: string | undefined;
1969 keyParams?: string | undefined;
1970 keyType?: string | undefined;
1971 kind?: string | undefined;
1972 label?: string | undefined;
1973 list?: string | undefined;
1974 loop?: boolean | undefined;
1975 low?: number | undefined;
1976 manifest?: string | undefined;
1977 marginHeight?: number | undefined;
1978 marginWidth?: number | undefined;
1979 max?: number | string | undefined;
1980 maxLength?: number | undefined;
1981 media?: string | undefined;
1982 mediaGroup?: string | undefined;
1983 method?: string | undefined;
1984 min?: number | string | undefined;
1985 minLength?: number | undefined;
1986 multiple?: boolean | undefined;
1987 muted?: boolean | undefined;
1988 name?: string | undefined;
1989 noValidate?: boolean | undefined;
1990 open?: boolean | undefined;
1991 optimum?: number | undefined;
1992 pattern?: string | undefined;
1993 placeholder?: string | undefined;
1994 playsInline?: boolean | undefined;
1995 poster?: string | undefined;
1996 preload?: string | undefined;
1997 readOnly?: boolean | undefined;
1998 required?: boolean | undefined;
1999 reversed?: boolean | undefined;
2000 rows?: number | undefined;
2001 rowSpan?: number | undefined;
2002 sandbox?: string | undefined;
2003 scope?: string | undefined;
2004 scoped?: boolean | undefined;
2005 scrolling?: string | undefined;
2006 seamless?: boolean | undefined;
2007 selected?: boolean | undefined;
2008 shape?: string | undefined;
2009 size?: number | undefined;
2010 sizes?: string | undefined;
2011 span?: number | undefined;
2012 src?: string | undefined;
2013 srcDoc?: string | undefined;
2014 srcLang?: string | undefined;
2015 srcSet?: string | undefined;
2016 start?: number | undefined;
2017 step?: number | string | undefined;
2018 summary?: string | undefined;
2019 target?: string | undefined;
2020 type?: string | undefined;
2021 useMap?: string | undefined;
2022 value?: string | readonly string[] | number | undefined;
2023 width?: number | string | undefined;
2024 wmode?: string | undefined;
2025 wrap?: string | undefined;
2026 }
2027
2028 type HTMLAttributeReferrerPolicy =
2029 | ""
2030 | "no-referrer"
2031 | "no-referrer-when-downgrade"
2032 | "origin"
2033 | "origin-when-cross-origin"
2034 | "same-origin"
2035 | "strict-origin"
2036 | "strict-origin-when-cross-origin"
2037 | "unsafe-url";
2038
2039 type HTMLAttributeAnchorTarget =
2040 | "_self"
2041 | "_blank"
2042 | "_parent"
2043 | "_top"
2044 | (string & {});
2045
2046 interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
2047 download?: any;
2048 href?: string | undefined;
2049 hrefLang?: string | undefined;
2050 media?: string | undefined;
2051 ping?: string | undefined;
2052 target?: HTMLAttributeAnchorTarget | undefined;
2053 type?: string | undefined;
2054 referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
2055 }
2056
2057 interface AudioHTMLAttributes<T> extends MediaHTMLAttributes<T> {}
2058
2059 interface AreaHTMLAttributes<T> extends HTMLAttributes<T> {
2060 alt?: string | undefined;
2061 coords?: string | undefined;
2062 download?: any;
2063 href?: string | undefined;
2064 hrefLang?: string | undefined;
2065 media?: string | undefined;
2066 referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
2067 shape?: string | undefined;
2068 target?: string | undefined;
2069 }
2070
2071 interface BaseHTMLAttributes<T> extends HTMLAttributes<T> {
2072 href?: string | undefined;
2073 target?: string | undefined;
2074 }
2075
2076 interface BlockquoteHTMLAttributes<T> extends HTMLAttributes<T> {
2077 cite?: string | undefined;
2078 }
2079
2080 interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
2081 disabled?: boolean | undefined;
2082 form?: string | undefined;
2083 formAction?: string | undefined;
2084 formEncType?: string | undefined;
2085 formMethod?: string | undefined;
2086 formNoValidate?: boolean | undefined;
2087 formTarget?: string | undefined;
2088 name?: string | undefined;
2089 type?: "submit" | "reset" | "button" | undefined;
2090 value?: string | readonly string[] | number | undefined;
2091 }
2092
2093 interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> {
2094 height?: number | string | undefined;
2095 width?: number | string | undefined;
2096 }
2097
2098 interface ColHTMLAttributes<T> extends HTMLAttributes<T> {
2099 span?: number | undefined;
2100 width?: number | string | undefined;
2101 }
2102
2103 interface ColgroupHTMLAttributes<T> extends HTMLAttributes<T> {
2104 span?: number | undefined;
2105 }
2106
2107 interface DataHTMLAttributes<T> extends HTMLAttributes<T> {
2108 value?: string | readonly string[] | number | undefined;
2109 }
2110
2111 interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> {
2112 open?: boolean | undefined;
2113 onToggle?: ReactEventHandler<T> | undefined;
2114 name?: string | undefined;
2115 }
2116
2117 interface DelHTMLAttributes<T> extends HTMLAttributes<T> {
2118 cite?: string | undefined;
2119 dateTime?: string | undefined;
2120 }
2121
2122 interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
2123 onCancel?: ReactEventHandler<T> | undefined;
2124 onClose?: ReactEventHandler<T> | undefined;
2125 open?: boolean | undefined;
2126 }
2127
2128 interface EmbedHTMLAttributes<T> extends HTMLAttributes<T> {
2129 height?: number | string | undefined;
2130 src?: string | undefined;
2131 type?: string | undefined;
2132 width?: number | string | undefined;
2133 }
2134
2135 interface FieldsetHTMLAttributes<T> extends HTMLAttributes<T> {
2136 disabled?: boolean | undefined;
2137 form?: string | undefined;
2138 name?: string | undefined;
2139 }
2140
2141 interface FormHTMLAttributes<T> extends HTMLAttributes<T> {
2142 acceptCharset?: string | undefined;
2143 action?: string | undefined;
2144 autoComplete?: string | undefined;
2145 encType?: string | undefined;
2146 method?: string | undefined;
2147 name?: string | undefined;
2148 noValidate?: boolean | undefined;
2149 target?: string | undefined;
2150 }
2151
2152 interface HtmlHTMLAttributes<T> extends HTMLAttributes<T> {
2153 manifest?: string | undefined;
2154 }
2155
2156 interface IframeHTMLAttributes<T> extends HTMLAttributes<T> {
2157 allow?: string | undefined;
2158 allowFullScreen?: boolean | undefined;
2159 allowTransparency?: boolean | undefined;
2160 /** @deprecated */
2161 frameBorder?: number | string | undefined;
2162 height?: number | string | undefined;
2163 loading?: "eager" | "lazy" | undefined;
2164 /** @deprecated */
2165 marginHeight?: number | undefined;
2166 /** @deprecated */
2167 marginWidth?: number | undefined;
2168 name?: string | undefined;
2169 referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
2170 sandbox?: string | undefined;
2171 /** @deprecated */
2172 scrolling?: string | undefined;
2173 seamless?: boolean | undefined;
2174 src?: string | undefined;
2175 srcDoc?: string | undefined;
2176 width?: number | string | undefined;
2177 }
2178
2179 interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
2180 alt?: string | undefined;
2181 crossOrigin?: CrossOrigin;
2182 decoding?: "async" | "auto" | "sync" | undefined;
2183 height?: number | string | undefined;
2184 loading?: "eager" | "lazy" | undefined;
2185 referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
2186 sizes?: string | undefined;
2187 src?: string | undefined;
2188 srcSet?: string | undefined;
2189 useMap?: string | undefined;
2190 width?: number | string | undefined;
2191 }
2192
2193 interface InsHTMLAttributes<T> extends HTMLAttributes<T> {
2194 cite?: string | undefined;
2195 dateTime?: string | undefined;
2196 }
2197
2198 type HTMLInputTypeAttribute =
2199 | "button"
2200 | "checkbox"
2201 | "color"
2202 | "date"
2203 | "datetime-local"
2204 | "email"
2205 | "file"
2206 | "hidden"
2207 | "image"
2208 | "month"
2209 | "number"
2210 | "password"
2211 | "radio"
2212 | "range"
2213 | "reset"
2214 | "search"
2215 | "submit"
2216 | "tel"
2217 | "text"
2218 | "time"
2219 | "url"
2220 | "week"
2221 | (string & {});
2222
2223 interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
2224 accept?: string | undefined;
2225 alt?: string | undefined;
2226 autoComplete?: string | undefined;
2227 capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
2228 checked?: boolean | undefined;
2229 disabled?: boolean | undefined;
2230 enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
2231 form?: string | undefined;
2232 formAction?: string | undefined;
2233 formEncType?: string | undefined;
2234 formMethod?: string | undefined;
2235 formNoValidate?: boolean | undefined;
2236 formTarget?: string | undefined;
2237 height?: number | string | undefined;
2238 list?: string | undefined;
2239 max?: number | string | undefined;
2240 maxLength?: number | undefined;
2241 min?: number | string | undefined;
2242 minLength?: number | undefined;
2243 multiple?: boolean | undefined;
2244 name?: string | undefined;
2245 pattern?: string | undefined;
2246 placeholder?: string | undefined;
2247 readOnly?: boolean | undefined;
2248 required?: boolean | undefined;
2249 size?: number | undefined;
2250 src?: string | undefined;
2251 step?: number | string | undefined;
2252 type?: HTMLInputTypeAttribute | undefined;
2253 value?: string | readonly string[] | number | undefined;
2254 width?: number | string | undefined;
2255
2256 onChange?: ChangeEventHandler<T> | undefined;
2257 }
2258
2259 interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
2260 challenge?: string | undefined;
2261 disabled?: boolean | undefined;
2262 form?: string | undefined;
2263 keyType?: string | undefined;
2264 keyParams?: string | undefined;
2265 name?: string | undefined;
2266 }
2267
2268 interface LabelHTMLAttributes<T> extends HTMLAttributes<T> {
2269 form?: string | undefined;
2270 htmlFor?: string | undefined;
2271 }
2272
2273 interface LiHTMLAttributes<T> extends HTMLAttributes<T> {
2274 value?: string | readonly string[] | number | undefined;
2275 }
2276
2277 interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
2278 as?: string | undefined;
2279 crossOrigin?: CrossOrigin;
2280 fetchPriority?: "high" | "low" | "auto";
2281 href?: string | undefined;
2282 hrefLang?: string | undefined;
2283 integrity?: string | undefined;
2284 media?: string | undefined;
2285 imageSrcSet?: string | undefined;
2286 referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
2287 sizes?: string | undefined;
2288 type?: string | undefined;
2289 charSet?: string | undefined;
2290 }
2291
2292 interface MapHTMLAttributes<T> extends HTMLAttributes<T> {
2293 name?: string | undefined;
2294 }
2295
2296 interface MenuHTMLAttributes<T> extends HTMLAttributes<T> {
2297 type?: string | undefined;
2298 }
2299
2300 interface MediaHTMLAttributes<T> extends HTMLAttributes<T> {
2301 autoPlay?: boolean | undefined;
2302 controls?: boolean | undefined;
2303 controlsList?: string | undefined;
2304 crossOrigin?: CrossOrigin;
2305 loop?: boolean | undefined;
2306 mediaGroup?: string | undefined;
2307 muted?: boolean | undefined;
2308 playsInline?: boolean | undefined;
2309 preload?: string | undefined;
2310 src?: string | undefined;
2311 }
2312
2313 interface MetaHTMLAttributes<T> extends HTMLAttributes<T> {
2314 charSet?: string | undefined;
2315 content?: string | undefined;
2316 httpEquiv?: string | undefined;
2317 media?: string | undefined;
2318 name?: string | undefined;
2319 }
2320
2321 interface MeterHTMLAttributes<T> extends HTMLAttributes<T> {
2322 form?: string | undefined;
2323 high?: number | undefined;
2324 low?: number | undefined;
2325 max?: number | string | undefined;
2326 min?: number | string | undefined;
2327 optimum?: number | undefined;
2328 value?: string | readonly string[] | number | undefined;
2329 }
2330
2331 interface QuoteHTMLAttributes<T> extends HTMLAttributes<T> {
2332 cite?: string | undefined;
2333 }
2334
2335 interface ObjectHTMLAttributes<T> extends HTMLAttributes<T> {
2336 classID?: string | undefined;
2337 data?: string | undefined;
2338 form?: string | undefined;
2339 height?: number | string | undefined;
2340 name?: string | undefined;
2341 type?: string | undefined;
2342 useMap?: string | undefined;
2343 width?: number | string | undefined;
2344 wmode?: string | undefined;
2345 }
2346
2347 interface OlHTMLAttributes<T> extends HTMLAttributes<T> {
2348 reversed?: boolean | undefined;
2349 start?: number | undefined;
2350 type?: "1" | "a" | "A" | "i" | "I" | undefined;
2351 }
2352
2353 interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> {
2354 disabled?: boolean | undefined;
2355 label?: string | undefined;
2356 }
2357
2358 interface OptionHTMLAttributes<T> extends HTMLAttributes<T> {
2359 disabled?: boolean | undefined;
2360 label?: string | undefined;
2361 selected?: boolean | undefined;
2362 value?: string | readonly string[] | number | undefined;
2363 }
2364
2365 interface OutputHTMLAttributes<T> extends HTMLAttributes<T> {
2366 form?: string | undefined;
2367 htmlFor?: string | undefined;
2368 name?: string | undefined;
2369 }
2370
2371 interface ParamHTMLAttributes<T> extends HTMLAttributes<T> {
2372 name?: string | undefined;
2373 value?: string | readonly string[] | number | undefined;
2374 }
2375
2376 interface ProgressHTMLAttributes<T> extends HTMLAttributes<T> {
2377 max?: number | string | undefined;
2378 value?: string | readonly string[] | number | undefined;
2379 }
2380
2381 interface SlotHTMLAttributes<T> extends HTMLAttributes<T> {
2382 name?: string | undefined;
2383 }
2384
2385 interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
2386 async?: boolean | undefined;
2387 /** @deprecated */
2388 charSet?: string | undefined;
2389 crossOrigin?: CrossOrigin;
2390 defer?: boolean | undefined;
2391 integrity?: string | undefined;
2392 noModule?: boolean | undefined;
2393 referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
2394 src?: string | undefined;
2395 type?: string | undefined;
2396 }
2397
2398 interface SelectHTMLAttributes<T> extends HTMLAttributes<T> {
2399 autoComplete?: string | undefined;
2400 disabled?: boolean | undefined;
2401 form?: string | undefined;
2402 multiple?: boolean | undefined;
2403 name?: string | undefined;
2404 required?: boolean | undefined;
2405 size?: number | undefined;
2406 value?: string | readonly string[] | number | undefined;
2407 onChange?: ChangeEventHandler<T> | undefined;
2408 }
2409
2410 interface SourceHTMLAttributes<T> extends HTMLAttributes<T> {
2411 height?: number | string | undefined;
2412 media?: string | undefined;
2413 sizes?: string | undefined;
2414 src?: string | undefined;
2415 srcSet?: string | undefined;
2416 type?: string | undefined;
2417 width?: number | string | undefined;
2418 }
2419
2420 interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
2421 media?: string | undefined;
2422 scoped?: boolean | undefined;
2423 type?: string | undefined;
2424 }
2425
2426 interface TableHTMLAttributes<T> extends HTMLAttributes<T> {
2427 cellPadding?: number | string | undefined;
2428 cellSpacing?: number | string | undefined;
2429 summary?: string | undefined;
2430 width?: number | string | undefined;
2431 }
2432
2433 interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> {
2434 autoComplete?: string | undefined;
2435 cols?: number | undefined;
2436 dirName?: string | undefined;
2437 disabled?: boolean | undefined;
2438 form?: string | undefined;
2439 maxLength?: number | undefined;
2440 minLength?: number | undefined;
2441 name?: string | undefined;
2442 placeholder?: string | undefined;
2443 readOnly?: boolean | undefined;
2444 required?: boolean | undefined;
2445 rows?: number | undefined;
2446 value?: string | readonly string[] | number | undefined;
2447 wrap?: string | undefined;
2448
2449 onChange?: ChangeEventHandler<T> | undefined;
2450 }
2451
2452 interface TdHTMLAttributes<T> extends HTMLAttributes<T> {
2453 align?: "left" | "center" | "right" | "justify" | "char" | undefined;
2454 colSpan?: number | undefined;
2455 headers?: string | undefined;
2456 rowSpan?: number | undefined;
2457 scope?: string | undefined;
2458 abbr?: string | undefined;
2459 height?: number | string | undefined;
2460 width?: number | string | undefined;
2461 valign?: "top" | "middle" | "bottom" | "baseline" | undefined;
2462 }
2463
2464 interface ThHTMLAttributes<T> extends HTMLAttributes<T> {
2465 align?: "left" | "center" | "right" | "justify" | "char" | undefined;
2466 colSpan?: number | undefined;
2467 headers?: string | undefined;
2468 rowSpan?: number | undefined;
2469 scope?: string | undefined;
2470 abbr?: string | undefined;
2471 }
2472
2473 interface TimeHTMLAttributes<T> extends HTMLAttributes<T> {
2474 dateTime?: string | undefined;
2475 }
2476
2477 interface TrackHTMLAttributes<T> extends HTMLAttributes<T> {
2478 default?: boolean | undefined;
2479 kind?: string | undefined;
2480 label?: string | undefined;
2481 src?: string | undefined;
2482 srcLang?: string | undefined;
2483 }
2484
2485 interface VideoHTMLAttributes<T> extends MediaHTMLAttributes<T> {
2486 height?: number | string | undefined;
2487 playsInline?: boolean | undefined;
2488 poster?: string | undefined;
2489 width?: number | string | undefined;
2490 disablePictureInPicture?: boolean | undefined;
2491 disableRemotePlayback?: boolean | undefined;
2492 }
2493
2494 // this list is "complete" in that it contains every SVG attribute
2495 // that React supports, but the types can be improved.
2496 // Full list here: https://facebook.github.io/react/docs/dom-elements.html
2497 //
2498 // The three broad type categories are (in order of restrictiveness):
2499 // - "number | string"
2500 // - "string"
2501 // - union of string literals
2502 interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
2503 // Attributes which also defined in HTMLAttributes
2504 // See comment in SVGDOMPropertyConfig.js
2505 className?: string | undefined;
2506 color?: string | undefined;
2507 height?: number | string | undefined;
2508 id?: string | undefined;
2509 lang?: string | undefined;
2510 max?: number | string | undefined;
2511 media?: string | undefined;
2512 method?: string | undefined;
2513 min?: number | string | undefined;
2514 name?: string | undefined;
2515 style?: CSSProperties | undefined;
2516 target?: string | undefined;
2517 type?: string | undefined;
2518 width?: number | string | undefined;
2519
2520 // Other HTML properties supported by SVG elements in browsers
2521 role?: AriaRole | undefined;
2522 tabIndex?: number | undefined;
2523 crossOrigin?: CrossOrigin;
2524
2525 // SVG Specific attributes
2526 accentHeight?: number | string | undefined;
2527 accumulate?: "none" | "sum" | undefined;
2528 additive?: "replace" | "sum" | undefined;
2529 alignmentBaseline?:
2530 | "auto"
2531 | "baseline"
2532 | "before-edge"
2533 | "text-before-edge"
2534 | "middle"
2535 | "central"
2536 | "after-edge"
2537 | "text-after-edge"
2538 | "ideographic"
2539 | "alphabetic"
2540 | "hanging"
2541 | "mathematical"
2542 | "inherit"
2543 | undefined;
2544 allowReorder?: "no" | "yes" | undefined;
2545 alphabetic?: number | string | undefined;
2546 amplitude?: number | string | undefined;
2547 arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined;
2548 ascent?: number | string | undefined;
2549 attributeName?: string | undefined;
2550 attributeType?: string | undefined;
2551 autoReverse?: Booleanish | undefined;
2552 azimuth?: number | string | undefined;
2553 baseFrequency?: number | string | undefined;
2554 baselineShift?: number | string | undefined;
2555 baseProfile?: number | string | undefined;
2556 bbox?: number | string | undefined;
2557 begin?: number | string | undefined;
2558 bias?: number | string | undefined;
2559 by?: number | string | undefined;
2560 calcMode?: number | string | undefined;
2561 capHeight?: number | string | undefined;
2562 clip?: number | string | undefined;
2563 clipPath?: string | undefined;
2564 clipPathUnits?: number | string | undefined;
2565 clipRule?: number | string | undefined;
2566 colorInterpolation?: number | string | undefined;
2567 colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined;
2568 colorProfile?: number | string | undefined;
2569 colorRendering?: number | string | undefined;
2570 contentScriptType?: number | string | undefined;
2571 contentStyleType?: number | string | undefined;
2572 cursor?: number | string | undefined;
2573 cx?: number | string | undefined;
2574 cy?: number | string | undefined;
2575 d?: string | undefined;
2576 decelerate?: number | string | undefined;
2577 descent?: number | string | undefined;
2578 diffuseConstant?: number | string | undefined;
2579 direction?: number | string | undefined;
2580 display?: number | string | undefined;
2581 divisor?: number | string | undefined;
2582 dominantBaseline?: number | string | undefined;
2583 dur?: number | string | undefined;
2584 dx?: number | string | undefined;
2585 dy?: number | string | undefined;
2586 edgeMode?: number | string | undefined;
2587 elevation?: number | string | undefined;
2588 enableBackground?: number | string | undefined;
2589 end?: number | string | undefined;
2590 exponent?: number | string | undefined;
2591 externalResourcesRequired?: Booleanish | undefined;
2592 fill?: string | undefined;
2593 fillOpacity?: number | string | undefined;
2594 fillRule?: "nonzero" | "evenodd" | "inherit" | undefined;
2595 filter?: string | undefined;
2596 filterRes?: number | string | undefined;
2597 filterUnits?: number | string | undefined;
2598 floodColor?: number | string | undefined;
2599 floodOpacity?: number | string | undefined;
2600 focusable?: Booleanish | "auto" | undefined;
2601 fontFamily?: string | undefined;
2602 fontSize?: number | string | undefined;
2603 fontSizeAdjust?: number | string | undefined;
2604 fontStretch?: number | string | undefined;
2605 fontStyle?: number | string | undefined;
2606 fontVariant?: number | string | undefined;
2607 fontWeight?: number | string | undefined;
2608 format?: number | string | undefined;
2609 fr?: number | string | undefined;
2610 from?: number | string | undefined;
2611 fx?: number | string | undefined;
2612 fy?: number | string | undefined;
2613 g1?: number | string | undefined;
2614 g2?: number | string | undefined;
2615 glyphName?: number | string | undefined;
2616 glyphOrientationHorizontal?: number | string | undefined;
2617 glyphOrientationVertical?: number | string | undefined;
2618 glyphRef?: number | string | undefined;
2619 gradientTransform?: string | undefined;
2620 gradientUnits?: string | undefined;
2621 hanging?: number | string | undefined;
2622 horizAdvX?: number | string | undefined;
2623 horizOriginX?: number | string | undefined;
2624 href?: string | undefined;
2625 ideographic?: number | string | undefined;
2626 imageRendering?: number | string | undefined;
2627 in2?: number | string | undefined;
2628 in?: string | undefined;
2629 intercept?: number | string | undefined;
2630 k1?: number | string | undefined;
2631 k2?: number | string | undefined;
2632 k3?: number | string | undefined;
2633 k4?: number | string | undefined;
2634 k?: number | string | undefined;
2635 kernelMatrix?: number | string | undefined;
2636 kernelUnitLength?: number | string | undefined;
2637 kerning?: number | string | undefined;
2638 keyPoints?: number | string | undefined;
2639 keySplines?: number | string | undefined;
2640 keyTimes?: number | string | undefined;
2641 lengthAdjust?: number | string | undefined;
2642 letterSpacing?: number | string | undefined;
2643 lightingColor?: number | string | undefined;
2644 limitingConeAngle?: number | string | undefined;
2645 local?: number | string | undefined;
2646 markerEnd?: string | undefined;
2647 markerHeight?: number | string | undefined;
2648 markerMid?: string | undefined;
2649 markerStart?: string | undefined;
2650 markerUnits?: number | string | undefined;
2651 markerWidth?: number | string | undefined;
2652 mask?: string | undefined;
2653 maskContentUnits?: number | string | undefined;
2654 maskUnits?: number | string | undefined;
2655 mathematical?: number | string | undefined;
2656 mode?: number | string | undefined;
2657 numOctaves?: number | string | undefined;
2658 offset?: number | string | undefined;
2659 opacity?: number | string | undefined;
2660 operator?: number | string | undefined;
2661 order?: number | string | undefined;
2662 orient?: number | string | undefined;
2663 orientation?: number | string | undefined;
2664 origin?: number | string | undefined;
2665 overflow?: number | string | undefined;
2666 overlinePosition?: number | string | undefined;
2667 overlineThickness?: number | string | undefined;
2668 paintOrder?: number | string | undefined;
2669 panose1?: number | string | undefined;
2670 path?: string | undefined;
2671 pathLength?: number | string | undefined;
2672 patternContentUnits?: string | undefined;
2673 patternTransform?: number | string | undefined;
2674 patternUnits?: string | undefined;
2675 pointerEvents?: number | string | undefined;
2676 points?: string | undefined;
2677 pointsAtX?: number | string | undefined;
2678 pointsAtY?: number | string | undefined;
2679 pointsAtZ?: number | string | undefined;
2680 preserveAlpha?: Booleanish | undefined;
2681 preserveAspectRatio?: string | undefined;
2682 primitiveUnits?: number | string | undefined;
2683 r?: number | string | undefined;
2684 radius?: number | string | undefined;
2685 refX?: number | string | undefined;
2686 refY?: number | string | undefined;
2687 renderingIntent?: number | string | undefined;
2688 repeatCount?: number | string | undefined;
2689 repeatDur?: number | string | undefined;
2690 requiredExtensions?: number | string | undefined;
2691 requiredFeatures?: number | string | undefined;
2692 restart?: number | string | undefined;
2693 result?: string | undefined;
2694 rotate?: number | string | undefined;
2695 rx?: number | string | undefined;
2696 ry?: number | string | undefined;
2697 scale?: number | string | undefined;
2698 seed?: number | string | undefined;
2699 shapeRendering?: number | string | undefined;
2700 slope?: number | string | undefined;
2701 spacing?: number | string | undefined;
2702 specularConstant?: number | string | undefined;
2703 specularExponent?: number | string | undefined;
2704 speed?: number | string | undefined;
2705 spreadMethod?: string | undefined;
2706 startOffset?: number | string | undefined;
2707 stdDeviation?: number | string | undefined;
2708 stemh?: number | string | undefined;
2709 stemv?: number | string | undefined;
2710 stitchTiles?: number | string | undefined;
2711 stopColor?: string | undefined;
2712 stopOpacity?: number | string | undefined;
2713 strikethroughPosition?: number | string | undefined;
2714 strikethroughThickness?: number | string | undefined;
2715 string?: number | string | undefined;
2716 stroke?: string | undefined;
2717 strokeDasharray?: string | number | undefined;
2718 strokeDashoffset?: string | number | undefined;
2719 strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined;
2720 strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined;
2721 strokeMiterlimit?: number | string | undefined;
2722 strokeOpacity?: number | string | undefined;
2723 strokeWidth?: number | string | undefined;
2724 surfaceScale?: number | string | undefined;
2725 systemLanguage?: number | string | undefined;
2726 tableValues?: number | string | undefined;
2727 targetX?: number | string | undefined;
2728 targetY?: number | string | undefined;
2729 textAnchor?: string | undefined;
2730 textDecoration?: number | string | undefined;
2731 textLength?: number | string | undefined;
2732 textRendering?: number | string | undefined;
2733 to?: number | string | undefined;
2734 transform?: string | undefined;
2735 u1?: number | string | undefined;
2736 u2?: number | string | undefined;
2737 underlinePosition?: number | string | undefined;
2738 underlineThickness?: number | string | undefined;
2739 unicode?: number | string | undefined;
2740 unicodeBidi?: number | string | undefined;
2741 unicodeRange?: number | string | undefined;
2742 unitsPerEm?: number | string | undefined;
2743 vAlphabetic?: number | string | undefined;
2744 values?: string | undefined;
2745 vectorEffect?: number | string | undefined;
2746 version?: string | undefined;
2747 vertAdvY?: number | string | undefined;
2748 vertOriginX?: number | string | undefined;
2749 vertOriginY?: number | string | undefined;
2750 vHanging?: number | string | undefined;
2751 vIdeographic?: number | string | undefined;
2752 viewBox?: string | undefined;
2753 viewTarget?: number | string | undefined;
2754 visibility?: number | string | undefined;
2755 vMathematical?: number | string | undefined;
2756 widths?: number | string | undefined;
2757 wordSpacing?: number | string | undefined;
2758 writingMode?: number | string | undefined;
2759 x1?: number | string | undefined;
2760 x2?: number | string | undefined;
2761 x?: number | string | undefined;
2762 xChannelSelector?: string | undefined;
2763 xHeight?: number | string | undefined;
2764 xlinkActuate?: string | undefined;
2765 xlinkArcrole?: string | undefined;
2766 xlinkHref?: string | undefined;
2767 xlinkRole?: string | undefined;
2768 xlinkShow?: string | undefined;
2769 xlinkTitle?: string | undefined;
2770 xlinkType?: string | undefined;
2771 xmlBase?: string | undefined;
2772 xmlLang?: string | undefined;
2773 xmlns?: string | undefined;
2774 xmlnsXlink?: string | undefined;
2775 xmlSpace?: string | undefined;
2776 y1?: number | string | undefined;
2777 y2?: number | string | undefined;
2778 y?: number | string | undefined;
2779 yChannelSelector?: string | undefined;
2780 z?: number | string | undefined;
2781 zoomAndPan?: string | undefined;
2782 }
2783
2784 interface WebViewHTMLAttributes<T> extends HTMLAttributes<T> {
2785 allowFullScreen?: boolean | undefined;
2786 allowpopups?: boolean | undefined;
2787 autosize?: boolean | undefined;
2788 blinkfeatures?: string | undefined;
2789 disableblinkfeatures?: string | undefined;
2790 disableguestresize?: boolean | undefined;
2791 disablewebsecurity?: boolean | undefined;
2792 guestinstance?: string | undefined;
2793 httpreferrer?: string | undefined;
2794 nodeintegration?: boolean | undefined;
2795 partition?: string | undefined;
2796 plugins?: boolean | undefined;
2797 preload?: string | undefined;
2798 src?: string | undefined;
2799 useragent?: string | undefined;
2800 webpreferences?: string | undefined;
2801 }
2802
2803 //
2804 // React.DOM
2805 // ----------------------------------------------------------------------
2806
2807 interface ReactHTML {
2808 a: DetailedHTMLFactory<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
2809 abbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2810 address: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2811 area: DetailedHTMLFactory<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
2812 article: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2813 aside: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2814 audio: DetailedHTMLFactory<AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
2815 b: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2816 base: DetailedHTMLFactory<BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>;
2817 bdi: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2818 bdo: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2819 big: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2820 blockquote: DetailedHTMLFactory<BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
2821 body: DetailedHTMLFactory<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
2822 br: DetailedHTMLFactory<HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
2823 button: DetailedHTMLFactory<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
2824 canvas: DetailedHTMLFactory<CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>;
2825 caption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2826 cite: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2827 code: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2828 col: DetailedHTMLFactory<ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
2829 colgroup: DetailedHTMLFactory<ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
2830 data: DetailedHTMLFactory<DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
2831 datalist: DetailedHTMLFactory<HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
2832 dd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2833 del: DetailedHTMLFactory<DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
2834 details: DetailedHTMLFactory<DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>;
2835 dfn: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2836 dialog: DetailedHTMLFactory<DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
2837 div: DetailedHTMLFactory<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
2838 dl: DetailedHTMLFactory<HTMLAttributes<HTMLDListElement>, HTMLDListElement>;
2839 dt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2840 em: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2841 embed: DetailedHTMLFactory<EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>;
2842 fieldset: DetailedHTMLFactory<FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>;
2843 figcaption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2844 figure: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2845 footer: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2846 form: DetailedHTMLFactory<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;
2847 h1: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
2848 h2: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
2849 h3: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
2850 h4: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
2851 h5: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
2852 h6: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
2853 head: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLHeadElement>;
2854 header: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2855 hgroup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2856 hr: DetailedHTMLFactory<HTMLAttributes<HTMLHRElement>, HTMLHRElement>;
2857 html: DetailedHTMLFactory<HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>;
2858 i: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2859 iframe: DetailedHTMLFactory<IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>;
2860 img: DetailedHTMLFactory<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
2861 input: DetailedHTMLFactory<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
2862 ins: DetailedHTMLFactory<InsHTMLAttributes<HTMLModElement>, HTMLModElement>;
2863 kbd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2864 keygen: DetailedHTMLFactory<KeygenHTMLAttributes<HTMLElement>, HTMLElement>;
2865 label: DetailedHTMLFactory<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
2866 legend: DetailedHTMLFactory<HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>;
2867 li: DetailedHTMLFactory<LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
2868 link: DetailedHTMLFactory<LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>;
2869 main: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2870 map: DetailedHTMLFactory<MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>;
2871 mark: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2872 menu: DetailedHTMLFactory<MenuHTMLAttributes<HTMLElement>, HTMLElement>;
2873 menuitem: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2874 meta: DetailedHTMLFactory<MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
2875 meter: DetailedHTMLFactory<MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>;
2876 nav: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2877 noscript: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2878 object: DetailedHTMLFactory<ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
2879 ol: DetailedHTMLFactory<OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
2880 optgroup: DetailedHTMLFactory<OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
2881 option: DetailedHTMLFactory<OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
2882 output: DetailedHTMLFactory<OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>;
2883 p: DetailedHTMLFactory<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
2884 param: DetailedHTMLFactory<ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
2885 picture: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2886 pre: DetailedHTMLFactory<HTMLAttributes<HTMLPreElement>, HTMLPreElement>;
2887 progress: DetailedHTMLFactory<ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>;
2888 q: DetailedHTMLFactory<QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
2889 rp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2890 rt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2891 ruby: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2892 s: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2893 samp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2894 slot: DetailedHTMLFactory<SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>;
2895 script: DetailedHTMLFactory<ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>;
2896 section: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2897 select: DetailedHTMLFactory<SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
2898 small: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2899 source: DetailedHTMLFactory<SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>;
2900 span: DetailedHTMLFactory<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
2901 strong: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2902 style: DetailedHTMLFactory<StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;
2903 sub: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2904 summary: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2905 sup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2906 table: DetailedHTMLFactory<TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>;
2907 template: DetailedHTMLFactory<HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>;
2908 tbody: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
2909 td: DetailedHTMLFactory<TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>;
2910 textarea: DetailedHTMLFactory<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
2911 tfoot: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
2912 th: DetailedHTMLFactory<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
2913 thead: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
2914 time: DetailedHTMLFactory<TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>;
2915 title: DetailedHTMLFactory<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
2916 tr: DetailedHTMLFactory<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
2917 track: DetailedHTMLFactory<TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
2918 u: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2919 ul: DetailedHTMLFactory<HTMLAttributes<HTMLUListElement>, HTMLUListElement>;
2920 "var": DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2921 video: DetailedHTMLFactory<VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
2922 wbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
2923 webview: DetailedHTMLFactory<WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>;
2924 }
2925
2926 interface ReactSVG {
2927 animate: SVGFactory;
2928 circle: SVGFactory;
2929 clipPath: SVGFactory;
2930 defs: SVGFactory;
2931 desc: SVGFactory;
2932 ellipse: SVGFactory;
2933 feBlend: SVGFactory;
2934 feColorMatrix: SVGFactory;
2935 feComponentTransfer: SVGFactory;
2936 feComposite: SVGFactory;
2937 feConvolveMatrix: SVGFactory;
2938 feDiffuseLighting: SVGFactory;
2939 feDisplacementMap: SVGFactory;
2940 feDistantLight: SVGFactory;
2941 feDropShadow: SVGFactory;
2942 feFlood: SVGFactory;
2943 feFuncA: SVGFactory;
2944 feFuncB: SVGFactory;
2945 feFuncG: SVGFactory;
2946 feFuncR: SVGFactory;
2947 feGaussianBlur: SVGFactory;
2948 feImage: SVGFactory;
2949 feMerge: SVGFactory;
2950 feMergeNode: SVGFactory;
2951 feMorphology: SVGFactory;
2952 feOffset: SVGFactory;
2953 fePointLight: SVGFactory;
2954 feSpecularLighting: SVGFactory;
2955 feSpotLight: SVGFactory;
2956 feTile: SVGFactory;
2957 feTurbulence: SVGFactory;
2958 filter: SVGFactory;
2959 foreignObject: SVGFactory;
2960 g: SVGFactory;
2961 image: SVGFactory;
2962 line: SVGFactory;
2963 linearGradient: SVGFactory;
2964 marker: SVGFactory;
2965 mask: SVGFactory;
2966 metadata: SVGFactory;
2967 path: SVGFactory;
2968 pattern: SVGFactory;
2969 polygon: SVGFactory;
2970 polyline: SVGFactory;
2971 radialGradient: SVGFactory;
2972 rect: SVGFactory;
2973 stop: SVGFactory;
2974 svg: SVGFactory;
2975 switch: SVGFactory;
2976 symbol: SVGFactory;
2977 text: SVGFactory;
2978 textPath: SVGFactory;
2979 tspan: SVGFactory;
2980 use: SVGFactory;
2981 view: SVGFactory;
2982 }
2983
2984 interface ReactDOM extends ReactHTML, ReactSVG {}
2985
2986 //
2987 // React.PropTypes
2988 // ----------------------------------------------------------------------
2989
2990 type Validator<T> = PropTypes.Validator<T>;
2991
2992 type Requireable<T> = PropTypes.Requireable<T>;
2993
2994 type ValidationMap<T> = PropTypes.ValidationMap<T>;
2995
2996 type WeakValidationMap<T> = {
2997 [K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined>
2998 : undefined extends T[K] ? Validator<T[K] | null | undefined>
2999 : Validator<T[K]>;
3000 };
3001
3002 interface ReactPropTypes {
3003 any: typeof PropTypes.any;
3004 array: typeof PropTypes.array;
3005 bool: typeof PropTypes.bool;
3006 func: typeof PropTypes.func;
3007 number: typeof PropTypes.number;
3008 object: typeof PropTypes.object;
3009 string: typeof PropTypes.string;
3010 node: typeof PropTypes.node;
3011 element: typeof PropTypes.element;
3012 instanceOf: typeof PropTypes.instanceOf;
3013 oneOf: typeof PropTypes.oneOf;
3014 oneOfType: typeof PropTypes.oneOfType;
3015 arrayOf: typeof PropTypes.arrayOf;
3016 objectOf: typeof PropTypes.objectOf;
3017 shape: typeof PropTypes.shape;
3018 exact: typeof PropTypes.exact;
3019 }
3020
3021 //
3022 // React.Children
3023 // ----------------------------------------------------------------------
3024
3025 interface ReactChildren {
3026 map<T, C>(
3027 children: C | readonly C[],
3028 fn: (child: C, index: number) => T,
3029 ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
3030 forEach<C>(children: C | readonly C[], fn: (child: C, index: number) => void): void;
3031 count(children: any): number;
3032 only<C>(children: C): C extends any[] ? never : C;
3033 toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>;
3034 }
3035
3036 //
3037 // Browser Interfaces
3038 // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
3039 // ----------------------------------------------------------------------
3040
3041 interface AbstractView {
3042 styleMedia: StyleMedia;
3043 document: Document;
3044 }
3045
3046 interface Touch {
3047 identifier: number;
3048 target: EventTarget;
3049 screenX: number;
3050 screenY: number;
3051 clientX: number;
3052 clientY: number;
3053 pageX: number;
3054 pageY: number;
3055 }
3056
3057 interface TouchList {
3058 [index: number]: Touch;
3059 length: number;
3060 item(index: number): Touch;
3061 identifiedTouch(identifier: number): Touch;
3062 }
3063
3064 //
3065 // Error Interfaces
3066 // ----------------------------------------------------------------------
3067 interface ErrorInfo {
3068 /**
3069 * Captures which component contained the exception, and its ancestors.
3070 */
3071 componentStack: string;
3072 }
3073
3074 namespace JSX {
3075 interface Element extends GlobalJSXElement {}
3076 interface ElementClass extends GlobalJSXElementClass {}
3077 interface ElementAttributesProperty extends GlobalJSXElementAttributesProperty {}
3078 interface ElementChildrenAttribute extends GlobalJSXElementChildrenAttribute {}
3079
3080 type LibraryManagedAttributes<C, P> = GlobalJSXLibraryManagedAttributes<C, P>;
3081
3082 interface IntrinsicAttributes extends GlobalJSXIntrinsicAttributes {}
3083 interface IntrinsicClassAttributes<T> extends GlobalJSXIntrinsicClassAttributes<T> {}
3084 interface IntrinsicElements extends GlobalJSXIntrinsicElements {}
3085 }
3086}
3087
3088// naked 'any' type in a conditional type will short circuit and union both the then/else branches
3089// so boolean is only resolved for T = any
3090type IsExactlyAny<T> = boolean extends (T extends never ? true : false) ? true : false;
3091
3092type ExactlyAnyPropertyKeys<T> = { [K in keyof T]: IsExactlyAny<T[K]> extends true ? K : never }[keyof T];
3093type NotExactlyAnyPropertyKeys<T> = Exclude<keyof T, ExactlyAnyPropertyKeys<T>>;
3094
3095// Try to resolve ill-defined props like for JS users: props can be any, or sometimes objects with properties of type any
3096type MergePropTypes<P, T> =
3097 // Distribute over P in case it is a union type
3098 P extends any
3099 // If props is type any, use propTypes definitions
3100 ? IsExactlyAny<P> extends true ? T
3101 // If declared props have indexed properties, ignore inferred props entirely as keyof gets widened
3102 : string extends keyof P ? P
3103 // Prefer declared types which are not exactly any
3104 :
3105 & Pick<P, NotExactlyAnyPropertyKeys<P>>
3106 // For props which are exactly any, use the type inferred from propTypes if present
3107 & Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>>
3108 // Keep leftover props not specified in propTypes
3109 & Pick<P, Exclude<keyof P, keyof T>>
3110 : never;
3111
3112// Any prop that has a default prop becomes optional, but its type is unchanged
3113// Undeclared default props are augmented into the resulting allowable attributes
3114// If declared props have indexed properties, ignore default props entirely as keyof gets widened
3115// Wrap in an outer-level conditional type to allow distribution over props that are unions
3116type Defaultize<P, D> = P extends any ? string extends keyof P ? P
3117 :
3118 & Pick<P, Exclude<keyof P, keyof D>>
3119 & Partial<Pick<P, Extract<keyof P, keyof D>>>
3120 & Partial<Pick<D, Exclude<keyof D, keyof P>>>
3121 : never;
3122
3123type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D }
3124 ? Defaultize<MergePropTypes<P, PropTypes.InferProps<T>>, D>
3125 : C extends { propTypes: infer T } ? MergePropTypes<P, PropTypes.InferProps<T>>
3126 : C extends { defaultProps: infer D } ? Defaultize<P, D>
3127 : P;
3128
3129declare global {
3130 /**
3131 * @deprecated Use `React.JSX` instead of the global `JSX` namespace.
3132 */
3133 namespace JSX {
3134 interface Element extends React.ReactElement<any, any> {}
3135 interface ElementClass extends React.Component<any> {
3136 render(): React.ReactNode;
3137 }
3138 interface ElementAttributesProperty {
3139 props: {};
3140 }
3141 interface ElementChildrenAttribute {
3142 children: {};
3143 }
3144
3145 // We can't recurse forever because `type` can't be self-referential;
3146 // let's assume it's reasonable to do a single React.lazy() around a single React.memo() / vice-versa
3147 type LibraryManagedAttributes<C, P> = C extends
3148 React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
3149 ? T extends React.MemoExoticComponent<infer U> | React.LazyExoticComponent<infer U>
3150 ? ReactManagedAttributes<U, P>
3151 : ReactManagedAttributes<T, P>
3152 : ReactManagedAttributes<C, P>;
3153
3154 interface IntrinsicAttributes extends React.Attributes {}
3155 interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {}
3156
3157 interface IntrinsicElements {
3158 // HTML
3159 a: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
3160 abbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3161 address: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3162 area: React.DetailedHTMLProps<React.AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
3163 article: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3164 aside: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3165 audio: React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
3166 b: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3167 base: React.DetailedHTMLProps<React.BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>;
3168 bdi: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3169 bdo: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3170 big: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3171 blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
3172 body: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
3173 br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
3174 button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
3175 canvas: React.DetailedHTMLProps<React.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>;
3176 caption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3177 cite: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3178 code: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3179 col: React.DetailedHTMLProps<React.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
3180 colgroup: React.DetailedHTMLProps<React.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
3181 data: React.DetailedHTMLProps<React.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
3182 datalist: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
3183 dd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3184 del: React.DetailedHTMLProps<React.DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
3185 details: React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>;
3186 dfn: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3187 dialog: React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
3188 div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
3189 dl: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDListElement>, HTMLDListElement>;
3190 dt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3191 em: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3192 embed: React.DetailedHTMLProps<React.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>;
3193 fieldset: React.DetailedHTMLProps<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>;
3194 figcaption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3195 figure: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3196 footer: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3197 form: React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;
3198 h1: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
3199 h2: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
3200 h3: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
3201 h4: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
3202 h5: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
3203 h6: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
3204 head: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>;
3205 header: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3206 hgroup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3207 hr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHRElement>, HTMLHRElement>;
3208 html: React.DetailedHTMLProps<React.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>;
3209 i: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3210 iframe: React.DetailedHTMLProps<React.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>;
3211 img: React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
3212 input: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
3213 ins: React.DetailedHTMLProps<React.InsHTMLAttributes<HTMLModElement>, HTMLModElement>;
3214 kbd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3215 keygen: React.DetailedHTMLProps<React.KeygenHTMLAttributes<HTMLElement>, HTMLElement>;
3216 label: React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
3217 legend: React.DetailedHTMLProps<React.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>;
3218 li: React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
3219 link: React.DetailedHTMLProps<React.LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>;
3220 main: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3221 map: React.DetailedHTMLProps<React.MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>;
3222 mark: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3223 menu: React.DetailedHTMLProps<React.MenuHTMLAttributes<HTMLElement>, HTMLElement>;
3224 menuitem: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3225 meta: React.DetailedHTMLProps<React.MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
3226 meter: React.DetailedHTMLProps<React.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>;
3227 nav: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3228 noindex: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3229 noscript: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3230 object: React.DetailedHTMLProps<React.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
3231 ol: React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
3232 optgroup: React.DetailedHTMLProps<React.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
3233 option: React.DetailedHTMLProps<React.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
3234 output: React.DetailedHTMLProps<React.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>;
3235 p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
3236 param: React.DetailedHTMLProps<React.ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
3237 picture: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3238 pre: React.DetailedHTMLProps<React.HTMLAttributes<HTMLPreElement>, HTMLPreElement>;
3239 progress: React.DetailedHTMLProps<React.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>;
3240 q: React.DetailedHTMLProps<React.QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
3241 rp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3242 rt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3243 ruby: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3244 s: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3245 samp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3246 slot: React.DetailedHTMLProps<React.SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>;
3247 script: React.DetailedHTMLProps<React.ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>;
3248 section: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3249 select: React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
3250 small: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3251 source: React.DetailedHTMLProps<React.SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>;
3252 span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
3253 strong: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3254 style: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;
3255 sub: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3256 summary: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3257 sup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3258 table: React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>;
3259 template: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>;
3260 tbody: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
3261 td: React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>;
3262 textarea: React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
3263 tfoot: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
3264 th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
3265 thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
3266 time: React.DetailedHTMLProps<React.TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>;
3267 title: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
3268 tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
3269 track: React.DetailedHTMLProps<React.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
3270 u: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3271 ul: React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>;
3272 "var": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3273 video: React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
3274 wbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
3275 webview: React.DetailedHTMLProps<React.WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>;
3276
3277 // SVG
3278 svg: React.SVGProps<SVGSVGElement>;
3279
3280 animate: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateElement but is not in TypeScript's lib.dom.d.ts for now.
3281 animateMotion: React.SVGProps<SVGElement>;
3282 animateTransform: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateTransformElement but is not in TypeScript's lib.dom.d.ts for now.
3283 circle: React.SVGProps<SVGCircleElement>;
3284 clipPath: React.SVGProps<SVGClipPathElement>;
3285 defs: React.SVGProps<SVGDefsElement>;
3286 desc: React.SVGProps<SVGDescElement>;
3287 ellipse: React.SVGProps<SVGEllipseElement>;
3288 feBlend: React.SVGProps<SVGFEBlendElement>;
3289 feColorMatrix: React.SVGProps<SVGFEColorMatrixElement>;
3290 feComponentTransfer: React.SVGProps<SVGFEComponentTransferElement>;
3291 feComposite: React.SVGProps<SVGFECompositeElement>;
3292 feConvolveMatrix: React.SVGProps<SVGFEConvolveMatrixElement>;
3293 feDiffuseLighting: React.SVGProps<SVGFEDiffuseLightingElement>;
3294 feDisplacementMap: React.SVGProps<SVGFEDisplacementMapElement>;
3295 feDistantLight: React.SVGProps<SVGFEDistantLightElement>;
3296 feDropShadow: React.SVGProps<SVGFEDropShadowElement>;
3297 feFlood: React.SVGProps<SVGFEFloodElement>;
3298 feFuncA: React.SVGProps<SVGFEFuncAElement>;
3299 feFuncB: React.SVGProps<SVGFEFuncBElement>;
3300 feFuncG: React.SVGProps<SVGFEFuncGElement>;
3301 feFuncR: React.SVGProps<SVGFEFuncRElement>;
3302 feGaussianBlur: React.SVGProps<SVGFEGaussianBlurElement>;
3303 feImage: React.SVGProps<SVGFEImageElement>;
3304 feMerge: React.SVGProps<SVGFEMergeElement>;
3305 feMergeNode: React.SVGProps<SVGFEMergeNodeElement>;
3306 feMorphology: React.SVGProps<SVGFEMorphologyElement>;
3307 feOffset: React.SVGProps<SVGFEOffsetElement>;
3308 fePointLight: React.SVGProps<SVGFEPointLightElement>;
3309 feSpecularLighting: React.SVGProps<SVGFESpecularLightingElement>;
3310 feSpotLight: React.SVGProps<SVGFESpotLightElement>;
3311 feTile: React.SVGProps<SVGFETileElement>;
3312 feTurbulence: React.SVGProps<SVGFETurbulenceElement>;
3313 filter: React.SVGProps<SVGFilterElement>;
3314 foreignObject: React.SVGProps<SVGForeignObjectElement>;
3315 g: React.SVGProps<SVGGElement>;
3316 image: React.SVGProps<SVGImageElement>;
3317 line: React.SVGLineElementAttributes<SVGLineElement>;
3318 linearGradient: React.SVGProps<SVGLinearGradientElement>;
3319 marker: React.SVGProps<SVGMarkerElement>;
3320 mask: React.SVGProps<SVGMaskElement>;
3321 metadata: React.SVGProps<SVGMetadataElement>;
3322 mpath: React.SVGProps<SVGElement>;
3323 path: React.SVGProps<SVGPathElement>;
3324 pattern: React.SVGProps<SVGPatternElement>;
3325 polygon: React.SVGProps<SVGPolygonElement>;
3326 polyline: React.SVGProps<SVGPolylineElement>;
3327 radialGradient: React.SVGProps<SVGRadialGradientElement>;
3328 rect: React.SVGProps<SVGRectElement>;
3329 stop: React.SVGProps<SVGStopElement>;
3330 switch: React.SVGProps<SVGSwitchElement>;
3331 symbol: React.SVGProps<SVGSymbolElement>;
3332 text: React.SVGTextElementAttributes<SVGTextElement>;
3333 textPath: React.SVGProps<SVGTextPathElement>;
3334 tspan: React.SVGProps<SVGTSpanElement>;
3335 use: React.SVGProps<SVGUseElement>;
3336 view: React.SVGProps<SVGViewElement>;
3337 }
3338 }
3339}
3340
3341// React.JSX needs to point to global.JSX to keep global module augmentations intact.
3342// But we can't access global.JSX so we need to create these aliases instead.
3343// Once the global JSX namespace will be removed we replace React.JSX with the contents of global.JSX
3344interface GlobalJSXElement extends JSX.Element {}
3345interface GlobalJSXElementClass extends JSX.ElementClass {}
3346interface GlobalJSXElementAttributesProperty extends JSX.ElementAttributesProperty {}
3347interface GlobalJSXElementChildrenAttribute extends JSX.ElementChildrenAttribute {}
3348
3349type GlobalJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
3350
3351interface GlobalJSXIntrinsicAttributes extends JSX.IntrinsicAttributes {}
3352interface GlobalJSXIntrinsicClassAttributes<T> extends JSX.IntrinsicClassAttributes<T> {}
3353
3354interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {}
3355
\No newline at end of file