UNPKG

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