UNPKG

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