UNPKG

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