UNPKG

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