UNPKG

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