UNPKG

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