UNPKG

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