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