1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import * as CSS from "csstype";
|
8 | import * as PropTypes from "prop-types";
|
9 |
|
10 | type NativeAnimationEvent = AnimationEvent;
|
11 | type NativeClipboardEvent = ClipboardEvent;
|
12 | type NativeCompositionEvent = CompositionEvent;
|
13 | type NativeDragEvent = DragEvent;
|
14 | type NativeFocusEvent = FocusEvent;
|
15 | type NativeKeyboardEvent = KeyboardEvent;
|
16 | type NativeMouseEvent = MouseEvent;
|
17 | type NativeTouchEvent = TouchEvent;
|
18 | type NativePointerEvent = PointerEvent;
|
19 | type NativeTransitionEvent = TransitionEvent;
|
20 | type NativeUIEvent = UIEvent;
|
21 | type NativeWheelEvent = WheelEvent;
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | type Booleanish = boolean | "true" | "false";
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined;
|
33 |
|
34 | declare const UNDEFINED_VOID_ONLY: unique symbol;
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never };
|
43 | type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
44 |
|
45 |
|
46 | export = React;
|
47 | export as namespace React;
|
48 |
|
49 | declare namespace React {
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | |
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 | type ElementType<P = any, Tag extends keyof JSX.IntrinsicElements = keyof JSX.IntrinsicElements> =
|
89 | | { [K in Tag]: P extends JSX.IntrinsicElements[K] ? K : never }[Tag]
|
90 | | ComponentType<P>;
|
91 |
|
92 | |
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
|
105 |
|
106 | |
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 | type JSXElementConstructor<P> =
|
116 | | ((
|
117 | props: P,
|
118 | |
119 |
|
120 |
|
121 |
|
122 |
|
123 | deprecatedLegacyContext?: any,
|
124 | ) => ReactNode)
|
125 | | (new(
|
126 | props: P,
|
127 | |
128 |
|
129 |
|
130 |
|
131 |
|
132 | deprecatedLegacyContext?: any,
|
133 | ) => Component<any, any>);
|
134 |
|
135 | |
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 | interface RefObject<T> {
|
151 | |
152 |
|
153 |
|
154 | readonly current: T | null;
|
155 | }
|
156 |
|
157 | interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
|
158 | }
|
159 | |
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 | type RefCallback<T> = {
|
173 | bivarianceHack(
|
174 | instance: T | null,
|
175 | ):
|
176 | | void
|
177 | | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[
|
178 | keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES
|
179 | ];
|
180 | }["bivarianceHack"];
|
181 |
|
182 | |
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 | type Ref<T> = RefCallback<T> | RefObject<T> | null;
|
190 | |
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 | type LegacyRef<T> = string | Ref<T>;
|
203 |
|
204 | |
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 | type ElementRef<
|
222 | C extends
|
223 | | ForwardRefExoticComponent<any>
|
224 | | { new(props: any): Component<any> }
|
225 | | ((props: any, context?: any) => ReactNode)
|
226 | | keyof JSX.IntrinsicElements,
|
227 | > =
|
228 | // need to check first if `ref` is a valid prop for ts@3.0
|
229 | // otherwise it will infer `{}` instead of `never`
|
230 | "ref" extends keyof ComponentPropsWithRef<C>
|
231 | ? NonNullable<ComponentPropsWithRef<C>["ref"]> extends RefAttributes<
|
232 | infer Instance
|
233 | >["ref"] ? Instance
|
234 | : never
|
235 | : never;
|
236 |
|
237 | type ComponentState = any;
|
238 |
|
239 | /**
|
240 | * A value which uniquely identifies a node among items in an array.
|
241 | *
|
242 | * @see {@link https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key React Docs}
|
243 | */
|
244 | type Key = string | number | bigint;
|
245 |
|
246 | /**
|
247 | * @internal The props any component can receive.
|
248 | * You don't have to add this type. All components automatically accept these props.
|
249 | * ```tsx
|
250 | * const Component = () => <div />;
|
251 | * <Component key="one" />
|
252 | * ```
|
253 | *
|
254 | * WARNING: The implementation of a component will never have access to these attributes.
|
255 | * The following example would be incorrect usage because {@link Component} would never have access to `key`:
|
256 | * ```tsx
|
257 | * const Component = (props: React.Attributes) => props.key;
|
258 | * ```
|
259 | */
|
260 | interface Attributes {
|
261 | key?: Key | null | undefined;
|
262 | }
|
263 | /**
|
264 | * The props any component accepting refs can receive.
|
265 | * Class components, built-in browser components (e.g. `div`) and forwardRef components can receive refs and automatically accept these props.
|
266 | * ```tsx
|
267 | * const Component = forwardRef(() => <div />);
|
268 | * <Component ref={(current) => console.log(current)} />
|
269 | * ```
|
270 | *
|
271 | * You only need this type if you manually author the types of props that need to be compatible with legacy refs.
|
272 | * ```tsx
|
273 | * interface Props extends React.RefAttributes<HTMLDivElement> {}
|
274 | * declare const Component: React.FunctionComponent<Props>;
|
275 | * ```
|
276 | *
|
277 | * Otherwise it's simpler to directly use {@link Ref} since you can safely use the
|
278 | * props type to describe to props that a consumer can pass to the component
|
279 | * as well as describing the props the implementation of a component "sees".
|
280 | * {@link RefAttributes} is generally not safe to describe both consumer and seen props.
|
281 | *
|
282 | * ```tsx
|
283 | * interface Props extends {
|
284 | * ref?: React.Ref<HTMLDivElement> | undefined;
|
285 | * }
|
286 | * declare const Component: React.FunctionComponent<Props>;
|
287 | * ```
|
288 | *
|
289 | * WARNING: The implementation of a component will not have access to the same type in versions of React supporting string refs.
|
290 | * The following example would be incorrect usage because {@link Component} would never have access to a `ref` with type `string`
|
291 | * ```tsx
|
292 | * const Component = (props: React.RefAttributes) => props.ref;
|
293 | * ```
|
294 | */
|
295 | interface RefAttributes<T> extends Attributes {
|
296 | /**
|
297 | * Allows getting a ref to the component instance.
|
298 | * Once the component unmounts, React will set `ref.current` to `null`
|
299 | * (or call the ref with `null` if you passed a callback ref).
|
300 | *
|
301 | * @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}
|
302 | */
|
303 | ref?: LegacyRef<T> | undefined;
|
304 | }
|
305 |
|
306 | /**
|
307 | * Represents the built-in attributes available to class components.
|
308 | */
|
309 | interface ClassAttributes<T> extends RefAttributes<T> {
|
310 | }
|
311 |
|
312 | /**
|
313 | * Represents a JSX element.
|
314 | *
|
315 | * Where {@link ReactNode} represents everything that can be rendered, `ReactElement`
|
316 | * only represents JSX.
|
317 | *
|
318 | * @template P The type of the props object
|
319 | * @template T The type of the component or tag
|
320 | *
|
321 | * @example
|
322 | *
|
323 | * ```tsx
|
324 | * const element: ReactElement = <div />;
|
325 | * ```
|
326 | */
|
327 | interface ReactElement<
|
328 | P = any,
|
329 | T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>,
|
330 | > {
|
331 | type: T;
|
332 | props: P;
|
333 | key: string | null;
|
334 | }
|
335 |
|
336 | /**
|
337 | * @deprecated
|
338 | */
|
339 | interface ReactComponentElement<
|
340 | T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>,
|
341 | P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, "key" | "ref">>,
|
342 | > extends ReactElement<P, Exclude<T, number>> {}
|
343 |
|
344 | interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
|
345 | ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
|
346 | }
|
347 |
|
348 | type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>;
|
349 | interface ComponentElement<P, T extends Component<P, ComponentState>> extends ReactElement<P, ComponentClass<P>> {
|
350 | ref?: LegacyRef<T> | undefined;
|
351 | }
|
352 |
|
353 | /**
|
354 | * @deprecated Use {@link ComponentElement} instead.
|
355 | */
|
356 | type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
|
357 |
|
358 | // string fallback for custom web-components
|
359 | interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element>
|
360 | extends ReactElement<P, string>
|
361 | {
|
362 | ref: LegacyRef<T>;
|
363 | }
|
364 |
|
365 | // ReactHTML for ReactHTMLElement
|
366 | interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {}
|
367 |
|
368 | interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> {
|
369 | type: keyof ReactHTML;
|
370 | }
|
371 |
|
372 | // ReactSVG for ReactSVGElement
|
373 | interface ReactSVGElement extends DOMElement<SVGAttributes<SVGElement>, SVGElement> {
|
374 | type: keyof ReactSVG;
|
375 | }
|
376 |
|
377 | interface ReactPortal extends ReactElement {
|
378 | children: ReactNode;
|
379 | }
|
380 |
|
381 | //
|
382 | // Factories
|
383 | // ----------------------------------------------------------------------
|
384 |
|
385 | type Factory<P> = (props?: Attributes & P, ...children: ReactNode[]) => ReactElement<P>;
|
386 |
|
387 | /**
|
388 | * @deprecated Please use `FunctionComponentFactory`
|
389 | */
|
390 | type SFCFactory<P> = FunctionComponentFactory<P>;
|
391 |
|
392 | type FunctionComponentFactory<P> = (
|
393 | props?: Attributes & P,
|
394 | ...children: ReactNode[]
|
395 | ) => FunctionComponentElement<P>;
|
396 |
|
397 | type ComponentFactory<P, T extends Component<P, ComponentState>> = (
|
398 | props?: ClassAttributes<T> & P,
|
399 | ...children: ReactNode[]
|
400 | ) => CElement<P, T>;
|
401 |
|
402 | type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>;
|
403 | type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>;
|
404 |
|
405 | type DOMFactory<P extends DOMAttributes<T>, T extends Element> = (
|
406 | props?: ClassAttributes<T> & P | null,
|
407 | ...children: ReactNode[]
|
408 | ) => DOMElement<P, T>;
|
409 |
|
410 | interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {}
|
411 |
|
412 | interface DetailedHTMLFactory<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMFactory<P, T> {
|
413 | (props?: ClassAttributes<T> & P | null, ...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
|
414 | }
|
415 |
|
416 | interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> {
|
417 | (
|
418 | props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null,
|
419 | ...children: ReactNode[]
|
420 | ): ReactSVGElement;
|
421 | }
|
422 |
|
423 | /**
|
424 | * @deprecated - This type is not relevant when using React. Inline the type instead to make the intent clear.
|
425 | */
|
426 | type ReactText = string | number;
|
427 | /**
|
428 | * @deprecated - This type is not relevant when using React. Inline the type instead to make the intent clear.
|
429 | */
|
430 | type ReactChild = ReactElement | string | number;
|
431 |
|
432 | /**
|
433 | * @deprecated Use either `ReactNode[]` if you need an array or `Iterable<ReactNode>` if its passed to a host component.
|
434 | */
|
435 | interface ReactNodeArray extends ReadonlyArray<ReactNode> {}
|
436 | /**
|
437 | * WARNING: Not related to `React.Fragment`.
|
438 | * @deprecated This type is not relevant when using React. Inline the type instead to make the intent clear.
|
439 | */
|
440 | type ReactFragment = Iterable<ReactNode>;
|
441 |
|
442 | /**
|
443 | * Different release channels declare additional types of ReactNode this particular release channel accepts.
|
444 | * App or library types should never augment this interface.
|
445 | */
|
446 | interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {}
|
447 |
|
448 | /**
|
449 | * Represents all of the things React can render.
|
450 | *
|
451 | * Where {@link ReactElement} only represents JSX, `ReactNode` represents everything that can be rendered.
|
452 | *
|
453 | * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/reactnode/ React TypeScript Cheatsheet}
|
454 | *
|
455 | * @example
|
456 | *
|
457 | * ```tsx
|
458 | *
|
459 | * type Props = { children: ReactNode }
|
460 | *
|
461 | * const Component = ({ children }: Props) => <div>{children}</div>
|
462 | *
|
463 | * <Component>hello</Component>
|
464 | * ```
|
465 | *
|
466 | * @example
|
467 | *
|
468 | * ```tsx
|
469 | *
|
470 | * type Props = { customElement: ReactNode }
|
471 | *
|
472 | * const Component = ({ customElement }: Props) => <div>{customElement}</div>
|
473 | *
|
474 | * <Component customElement={<div>hello</div>} />
|
475 | * ```
|
476 | */
|
477 | // non-thenables need to be kept in sync with AwaitedReactNode
|
478 | type ReactNode =
|
479 | | ReactElement
|
480 | | string
|
481 | | number
|
482 | | Iterable<ReactNode>
|
483 | | ReactPortal
|
484 | | boolean
|
485 | | null
|
486 | | undefined
|
487 | | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
|
488 | keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES
|
489 | ];
|
490 |
|
491 | //
|
492 | // Top Level API
|
493 | // ----------------------------------------------------------------------
|
494 |
|
495 | // DOM Elements
|
496 | function createFactory<T extends HTMLElement>(
|
497 | type: keyof ReactHTML,
|
498 | ): HTMLFactory<T>;
|
499 | function createFactory(
|
500 | type: keyof ReactSVG,
|
501 | ): SVGFactory;
|
502 | function createFactory<P extends DOMAttributes<T>, T extends Element>(
|
503 | type: string,
|
504 | ): DOMFactory<P, T>;
|
505 |
|
506 | // Custom components
|
507 | function createFactory<P>(type: FunctionComponent<P>): FunctionComponentFactory<P>;
|
508 | function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
|
509 | type: ClassType<P, T, C>,
|
510 | ): CFactory<P, T>;
|
511 | function createFactory<P>(type: ComponentClass<P>): Factory<P>;
|
512 |
|
513 | // DOM Elements
|
514 | // TODO: generalize this to everything in `keyof ReactHTML`, not just "input"
|
515 | function createElement(
|
516 | type: "input",
|
517 | props?: InputHTMLAttributes<HTMLInputElement> & ClassAttributes<HTMLInputElement> | null,
|
518 | ...children: ReactNode[]
|
519 | ): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
520 | function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
|
521 | type: keyof ReactHTML,
|
522 | props?: ClassAttributes<T> & P | null,
|
523 | ...children: ReactNode[]
|
524 | ): DetailedReactHTMLElement<P, T>;
|
525 | function createElement<P extends SVGAttributes<T>, T extends SVGElement>(
|
526 | type: keyof ReactSVG,
|
527 | props?: ClassAttributes<T> & P | null,
|
528 | ...children: ReactNode[]
|
529 | ): ReactSVGElement;
|
530 | function createElement<P extends DOMAttributes<T>, T extends Element>(
|
531 | type: string,
|
532 | props?: ClassAttributes<T> & P | null,
|
533 | ...children: ReactNode[]
|
534 | ): DOMElement<P, T>;
|
535 |
|
536 | // Custom components
|
537 |
|
538 | function createElement<P extends {}>(
|
539 | type: FunctionComponent<P>,
|
540 | props?: Attributes & P | null,
|
541 | ...children: ReactNode[]
|
542 | ): FunctionComponentElement<P>;
|
543 | function createElement<P extends {}, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
|
544 | type: ClassType<P, T, C>,
|
545 | props?: ClassAttributes<T> & P | null,
|
546 | ...children: ReactNode[]
|
547 | ): CElement<P, T>;
|
548 | function createElement<P extends {}>(
|
549 | type: FunctionComponent<P> | ComponentClass<P> | string,
|
550 | props?: Attributes & P | null,
|
551 | ...children: ReactNode[]
|
552 | ): ReactElement<P>;
|
553 |
|
554 | // DOM Elements
|
555 | // ReactHTMLElement
|
556 | function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
|
557 | element: DetailedReactHTMLElement<P, T>,
|
558 | props?: P,
|
559 | ...children: ReactNode[]
|
560 | ): DetailedReactHTMLElement<P, T>;
|
561 | // ReactHTMLElement, less specific
|
562 | function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
|
563 | element: ReactHTMLElement<T>,
|
564 | props?: P,
|
565 | ...children: ReactNode[]
|
566 | ): ReactHTMLElement<T>;
|
567 | // SVGElement
|
568 | function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>(
|
569 | element: ReactSVGElement,
|
570 | props?: P,
|
571 | ...children: ReactNode[]
|
572 | ): ReactSVGElement;
|
573 | // DOM Element (has to be the last, because type checking stops at first overload that fits)
|
574 | function cloneElement<P extends DOMAttributes<T>, T extends Element>(
|
575 | element: DOMElement<P, T>,
|
576 | props?: DOMAttributes<T> & P,
|
577 | ...children: ReactNode[]
|
578 | ): DOMElement<P, T>;
|
579 |
|
580 | // Custom components
|
581 | function cloneElement<P>(
|
582 | element: FunctionComponentElement<P>,
|
583 | props?: Partial<P> & Attributes,
|
584 | ...children: ReactNode[]
|
585 | ): FunctionComponentElement<P>;
|
586 | function cloneElement<P, T extends Component<P, ComponentState>>(
|
587 | element: CElement<P, T>,
|
588 | props?: Partial<P> & ClassAttributes<T>,
|
589 | ...children: ReactNode[]
|
590 | ): CElement<P, T>;
|
591 | function cloneElement<P>(
|
592 | element: ReactElement<P>,
|
593 | props?: Partial<P> & Attributes,
|
594 | ...children: ReactNode[]
|
595 | ): ReactElement<P>;
|
596 |
|
597 | /**
|
598 | * Describes the props accepted by a Context {@link Provider}.
|
599 | *
|
600 | * @template T The type of the value the context provides.
|
601 | */
|
602 | interface ProviderProps<T> {
|
603 | value: T;
|
604 | children?: ReactNode | undefined;
|
605 | }
|
606 |
|
607 | /**
|
608 | * Describes the props accepted by a Context {@link Consumer}.
|
609 | *
|
610 | * @template T The type of the value the context provides.
|
611 | */
|
612 | interface ConsumerProps<T> {
|
613 | children: (value: T) => ReactNode;
|
614 | }
|
615 |
|
616 | /**
|
617 | * An object masquerading as a component. These are created by functions
|
618 | * like {@link forwardRef}, {@link memo}, and {@link createContext}.
|
619 | *
|
620 | * In order to make TypeScript work, we pretend that they are normal
|
621 | * components.
|
622 | *
|
623 | * But they are, in fact, not callable - instead, they are objects which
|
624 | * are treated specially by the renderer.
|
625 | *
|
626 | * @template P The props the component accepts.
|
627 | */
|
628 | interface ExoticComponent<P = {}> {
|
629 | (props: P): ReactNode;
|
630 | readonly $$typeof: symbol;
|
631 | }
|
632 |
|
633 | /**
|
634 | * An {@link ExoticComponent} with a `displayName` property applied to it.
|
635 | *
|
636 | * @template P The props the component accepts.
|
637 | */
|
638 | interface NamedExoticComponent<P = {}> extends ExoticComponent<P> {
|
639 | /**
|
640 | * Used in debugging messages. You might want to set it
|
641 | * explicitly if you want to display a different name for
|
642 | * debugging purposes.
|
643 | *
|
644 | * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
|
645 | */
|
646 | displayName?: string | undefined;
|
647 | }
|
648 |
|
649 | /**
|
650 | * An {@link ExoticComponent} with a `propTypes` property applied to it.
|
651 | *
|
652 | * @template P The props the component accepts.
|
653 | */
|
654 | interface ProviderExoticComponent<P> extends ExoticComponent<P> {
|
655 | propTypes?: WeakValidationMap<P> | undefined;
|
656 | }
|
657 |
|
658 | /**
|
659 | * Used to retrieve the type of a context object from a {@link Context}.
|
660 | *
|
661 | * @template C The context object.
|
662 | *
|
663 | * @example
|
664 | *
|
665 | * ```tsx
|
666 | * import { createContext } from 'react';
|
667 | *
|
668 | * const MyContext = createContext({ foo: 'bar' });
|
669 | *
|
670 | * type ContextType = ContextType<typeof MyContext>;
|
671 | *
|
672 | * ```
|
673 | */
|
674 | type ContextType<C extends Context<any>> = C extends Context<infer T> ? T : never;
|
675 |
|
676 | /**
|
677 | * Wraps your components to specify the value of this context for all components inside.
|
678 | *
|
679 | * @see {@link https://react.dev/reference/react/createContext#provider React Docs}
|
680 | *
|
681 | * @example
|
682 | *
|
683 | * ```tsx
|
684 | * import { createContext } from 'react';
|
685 | *
|
686 | * const ThemeContext = createContext('light');
|
687 | *
|
688 | * function App() {
|
689 | * return (
|
690 | * <ThemeContext.Provider value="dark">
|
691 | * <Toolbar />
|
692 | * </ThemeContext.Provider>
|
693 | * );
|
694 | * }
|
695 | * ```
|
696 | */
|
697 | type Provider<T> = ProviderExoticComponent<ProviderProps<T>>;
|
698 |
|
699 | /**
|
700 | * The old way to read context, before {@link useContext} existed.
|
701 | *
|
702 | * @see {@link https://react.dev/reference/react/createContext#consumer React Docs}
|
703 | *
|
704 | * @example
|
705 | *
|
706 | * ```tsx
|
707 | * import { UserContext } from './user-context';
|
708 | *
|
709 | * function Avatar() {
|
710 | * return (
|
711 | * <UserContext.Consumer>
|
712 | * {user => <img src={user.profileImage} alt={user.name} />}
|
713 | * </UserContext.Consumer>
|
714 | * );
|
715 | * }
|
716 | * ```
|
717 | */
|
718 | type Consumer<T> = ExoticComponent<ConsumerProps<T>>;
|
719 |
|
720 | /**
|
721 | * Context lets components pass information deep down without explicitly
|
722 | * passing props.
|
723 | *
|
724 | * Created from {@link createContext}
|
725 | *
|
726 | * @see {@link https://react.dev/learn/passing-data-deeply-with-context React Docs}
|
727 | * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet}
|
728 | *
|
729 | * @example
|
730 | *
|
731 | * ```tsx
|
732 | * import { createContext } from 'react';
|
733 | *
|
734 | * const ThemeContext = createContext('light');
|
735 | * ```
|
736 | */
|
737 | interface Context<T> {
|
738 | Provider: Provider<T>;
|
739 | Consumer: Consumer<T>;
|
740 | /**
|
741 | * Used in debugging messages. You might want to set it
|
742 | * explicitly if you want to display a different name for
|
743 | * debugging purposes.
|
744 | *
|
745 | * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
|
746 | */
|
747 | displayName?: string | undefined;
|
748 | }
|
749 |
|
750 | /**
|
751 | * Lets you create a {@link Context} that components can provide or read.
|
752 | *
|
753 | * @param defaultValue The value you want the context to have when there is no matching
|
754 | * {@link Provider} in the tree above the component reading the context. This is meant
|
755 | * as a "last resort" fallback.
|
756 | *
|
757 | * @see {@link https://react.dev/reference/react/createContext#reference React Docs}
|
758 | * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet}
|
759 | *
|
760 | * @example
|
761 | *
|
762 | * ```tsx
|
763 | * import { createContext } from 'react';
|
764 | *
|
765 | * const ThemeContext = createContext('light');
|
766 | * ```
|
767 | */
|
768 | function createContext<T>(
|
769 | // If you thought this should be optional, see
|
770 | // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24509#issuecomment-382213106
|
771 | defaultValue: T,
|
772 | ): Context<T>;
|
773 |
|
774 | function isValidElement<P>(object: {} | null | undefined): object is ReactElement<P>;
|
775 |
|
776 | /**
|
777 | * Maintainer's note: Sync with {@link ReactChildren} until {@link ReactChildren} is removed.
|
778 | */
|
779 | const Children: {
|
780 | map<T, C>(
|
781 | children: C | readonly C[],
|
782 | fn: (child: C, index: number) => T,
|
783 | ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
|
784 | forEach<C>(children: C | readonly C[], fn: (child: C, index: number) => void): void;
|
785 | count(children: any): number;
|
786 | only<C>(children: C): C extends any[] ? never : C;
|
787 | toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>;
|
788 | };
|
789 | /**
|
790 | * Lets you group elements without a wrapper node.
|
791 | *
|
792 | * @see {@link https://react.dev/reference/react/Fragment React Docs}
|
793 | *
|
794 | * @example
|
795 | *
|
796 | * ```tsx
|
797 | * import { Fragment } from 'react';
|
798 | *
|
799 | * <Fragment>
|
800 | * <td>Hello</td>
|
801 | * <td>World</td>
|
802 | * </Fragment>
|
803 | * ```
|
804 | *
|
805 | * @example
|
806 | *
|
807 | * ```tsx
|
808 | *
|
809 | *
|
810 | * <>
|
811 | * <td>Hello</td>
|
812 | * <td>World</td>
|
813 | * </>
|
814 | * ```
|
815 | */
|
816 | const Fragment: ExoticComponent<{ children?: ReactNode | undefined }>;
|
817 |
|
818 | /**
|
819 | * Lets you find common bugs in your components early during development.
|
820 | *
|
821 | * @see {@link https://react.dev/reference/react/StrictMode React Docs}
|
822 | *
|
823 | * @example
|
824 | *
|
825 | * ```tsx
|
826 | * import { StrictMode } from 'react';
|
827 | *
|
828 | * <StrictMode>
|
829 | * <App />
|
830 | * </StrictMode>
|
831 | * ```
|
832 | */
|
833 | const StrictMode: ExoticComponent<{ children?: ReactNode | undefined }>;
|
834 |
|
835 | /**
|
836 | * The props accepted by {@link Suspense}.
|
837 | *
|
838 | * @see {@link https://react.dev/reference/react/Suspense React Docs}
|
839 | */
|
840 | interface SuspenseProps {
|
841 | children?: ReactNode | undefined;
|
842 |
|
843 | /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */
|
844 | fallback?: ReactNode;
|
845 | }
|
846 |
|
847 | /**
|
848 | * Lets you display a fallback until its children have finished loading.
|
849 | *
|
850 | * @see {@link https://react.dev/reference/react/Suspense React Docs}
|
851 | *
|
852 | * @example
|
853 | *
|
854 | * ```tsx
|
855 | * import { Suspense } from 'react';
|
856 | *
|
857 | * <Suspense fallback={<Loading />}>
|
858 | * <ProfileDetails />
|
859 | * </Suspense>
|
860 | * ```
|
861 | */
|
862 | const Suspense: ExoticComponent<SuspenseProps>;
|
863 | const version: string;
|
864 |
|
865 | /**
|
866 | * The callback passed to {@link ProfilerProps.onRender}.
|
867 | *
|
868 | * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
|
869 | */
|
870 | type ProfilerOnRenderCallback = (
|
871 | /**
|
872 | * The string id prop of the {@link Profiler} tree that has just committed. This lets
|
873 | * you identify which part of the tree was committed if you are using multiple
|
874 | * profilers.
|
875 | *
|
876 | * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
|
877 | */
|
878 | id: string,
|
879 | /**
|
880 | * This lets you know whether the tree has just been mounted for the first time
|
881 | * or re-rendered due to a change in props, state, or hooks.
|
882 | *
|
883 | * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
|
884 | */
|
885 | phase: "mount" | "update" | "nested-update",
|
886 | /**
|
887 | * The number of milliseconds spent rendering the {@link Profiler} and its descendants
|
888 | * for the current update. This indicates how well the subtree makes use of
|
889 | * memoization (e.g. {@link memo} and {@link useMemo}). Ideally this value should decrease
|
890 | * significantly after the initial mount as many of the descendants will only need to
|
891 | * re-render if their specific props change.
|
892 | *
|
893 | * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
|
894 | */
|
895 | actualDuration: number,
|
896 | /**
|
897 | * The number of milliseconds estimating how much time it would take to re-render the entire
|
898 | * {@link Profiler} subtree without any optimizations. It is calculated by summing up the most
|
899 | * recent render durations of each component in the tree. This value estimates a worst-case
|
900 | * cost of rendering (e.g. the initial mount or a tree with no memoization). Compare
|
901 | * {@link actualDuration} against it to see if memoization is working.
|
902 | *
|
903 | * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
|
904 | */
|
905 | baseDuration: number,
|
906 | /**
|
907 | * A numeric timestamp for when React began rendering the current update.
|
908 | *
|
909 | * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
|
910 | */
|
911 | startTime: number,
|
912 | /**
|
913 | * A numeric timestamp for when React committed the current update. This value is shared
|
914 | * between all profilers in a commit, enabling them to be grouped if desirable.
|
915 | *
|
916 | * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
|
917 | */
|
918 | commitTime: number,
|
919 | ) => void;
|
920 |
|
921 | /**
|
922 | * The props accepted by {@link Profiler}.
|
923 | *
|
924 | * @see {@link https://react.dev/reference/react/Profiler React Docs}
|
925 | */
|
926 | interface ProfilerProps {
|
927 | children?: ReactNode | undefined;
|
928 | id: string;
|
929 | onRender: ProfilerOnRenderCallback;
|
930 | }
|
931 |
|
932 | /**
|
933 | * Lets you measure rendering performance of a React tree programmatically.
|
934 | *
|
935 | * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
|
936 | *
|
937 | * @example
|
938 | *
|
939 | * ```tsx
|
940 | * <Profiler id="App" onRender={onRender}>
|
941 | * <App />
|
942 | * </Profiler>
|
943 | * ```
|
944 | */
|
945 | const Profiler: ExoticComponent<ProfilerProps>;
|
946 |
|
947 | //
|
948 | // Component API
|
949 | // ----------------------------------------------------------------------
|
950 |
|
951 | type ReactInstance = Component<any> | Element;
|
952 |
|
953 | // Base component for plain JS classes
|
954 | interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {}
|
955 | class Component<P, S> {
|
956 | /**
|
957 | * If set, `this.context` will be set at runtime to the current value of the given Context.
|
958 | *
|
959 | * @example
|
960 | *
|
961 | * ```ts
|
962 | * type MyContext = number
|
963 | * const Ctx = React.createContext<MyContext>(0)
|
964 | *
|
965 | * class Foo extends React.Component {
|
966 | * static contextType = Ctx
|
967 | * context!: React.ContextType<typeof Ctx>
|
968 | * render () {
|
969 | * return <>My context's value: {this.context}</>;
|
970 | * }
|
971 | * }
|
972 | * ```
|
973 | *
|
974 | * @see {@link https://react.dev/reference/react/Component#static-contexttype}
|
975 | */
|
976 | static contextType?: Context<any> | undefined;
|
977 |
|
978 | /**
|
979 | * If using the new style context, re-declare this in your class to be the
|
980 | * `React.ContextType` of your `static contextType`.
|
981 | * Should be used with type annotation or static contextType.
|
982 | *
|
983 | * @example
|
984 | * ```ts
|
985 | * static contextType = MyContext
|
986 | *
|
987 | * context!: React.ContextType<typeof MyContext>
|
988 | *
|
989 | * declare context: React.ContextType<typeof MyContext>
|
990 | * ```
|
991 | *
|
992 | * @see {@link https://react.dev/reference/react/Component#context React Docs}
|
993 | */
|
994 | context: unknown;
|
995 |
|
996 | constructor(props: P);
|
997 | /**
|
998 | * @deprecated
|
999 | * @see {@link https://legacy.reactjs.org/docs/legacy-context.html React Docs}
|
1000 | */
|
1001 | constructor(props: P, context: any);
|
1002 |
|
1003 | // We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
|
1004 | // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
|
1005 | // Also, the ` | S` allows intellisense to not be dumbisense
|
1006 | setState<K extends keyof S>(
|
1007 | state: ((prevState: Readonly<S>, props: Readonly<P>) => Pick<S, K> | S | null) | (Pick<S, K> | S | null),
|
1008 | callback?: () => void,
|
1009 | ): void;
|
1010 |
|
1011 | forceUpdate(callback?: () => void): void;
|
1012 | render(): ReactNode;
|
1013 |
|
1014 | readonly props: Readonly<P>;
|
1015 | state: Readonly<S>;
|
1016 | /**
|
1017 | * @deprecated
|
1018 | *
|
1019 | * @see {@link https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs Legacy React Docs}
|
1020 | */
|
1021 | refs: {
|
1022 | [key: string]: ReactInstance;
|
1023 | };
|
1024 | }
|
1025 |
|
1026 | class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {}
|
1027 |
|
1028 | /**
|
1029 | * @deprecated Use `ClassicComponent` from `create-react-class`
|
1030 | *
|
1031 | * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs}
|
1032 | * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm}
|
1033 | */
|
1034 | interface ClassicComponent<P = {}, S = {}> extends Component<P, S> {
|
1035 | replaceState(nextState: S, callback?: () => void): void;
|
1036 | isMounted(): boolean;
|
1037 | getInitialState?(): S;
|
1038 | }
|
1039 |
|
1040 | interface ChildContextProvider<CC> {
|
1041 | getChildContext(): CC;
|
1042 | }
|
1043 |
|
1044 | //
|
1045 | // Class Interfaces
|
1046 | // ----------------------------------------------------------------------
|
1047 |
|
1048 | /**
|
1049 | * Represents the type of a function component. Can optionally
|
1050 | * receive a type argument that represents the props the component
|
1051 | * receives.
|
1052 | *
|
1053 | * @template P The props the component accepts.
|
1054 | * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet}
|
1055 | * @alias for {@link FunctionComponent}
|
1056 | *
|
1057 | * @example
|
1058 | *
|
1059 | * ```tsx
|
1060 | *
|
1061 | * type Props = { name: string }
|
1062 | *
|
1063 | * const MyComponent: FC<Props> = (props) => {
|
1064 | * return <div>{props.name}</div>
|
1065 | * }
|
1066 | * ```
|
1067 | *
|
1068 | * @example
|
1069 | *
|
1070 | * ```tsx
|
1071 | *
|
1072 | * const MyComponentWithoutProps: FC = () => {
|
1073 | * return <div>MyComponentWithoutProps</div>
|
1074 | * }
|
1075 | * ```
|
1076 | */
|
1077 | type FC<P = {}> = FunctionComponent<P>;
|
1078 |
|
1079 | /**
|
1080 | * Represents the type of a function component. Can optionally
|
1081 | * receive a type argument that represents the props the component
|
1082 | * accepts.
|
1083 | *
|
1084 | * @template P The props the component accepts.
|
1085 | * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet}
|
1086 | *
|
1087 | * @example
|
1088 | *
|
1089 | * ```tsx
|
1090 | *
|
1091 | * type Props = { name: string }
|
1092 | *
|
1093 | * const MyComponent: FunctionComponent<Props> = (props) => {
|
1094 | * return <div>{props.name}</div>
|
1095 | * }
|
1096 | * ```
|
1097 | *
|
1098 | * @example
|
1099 | *
|
1100 | * ```tsx
|
1101 | *
|
1102 | * const MyComponentWithoutProps: FunctionComponent = () => {
|
1103 | * return <div>MyComponentWithoutProps</div>
|
1104 | * }
|
1105 | * ```
|
1106 | */
|
1107 | interface FunctionComponent<P = {}> {
|
1108 | (props: P, context?: any): ReactNode;
|
1109 | /**
|
1110 | * Used to declare the types of the props accepted by the
|
1111 | * component. These types will be checked during rendering
|
1112 | * and in development only.
|
1113 | *
|
1114 | * We recommend using TypeScript instead of checking prop
|
1115 | * types at runtime.
|
1116 | *
|
1117 | * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs}
|
1118 | */
|
1119 | propTypes?: WeakValidationMap<P> | undefined;
|
1120 | /**
|
1121 | * @deprecated
|
1122 | *
|
1123 | * Lets you specify which legacy context is consumed by
|
1124 | * this component.
|
1125 | *
|
1126 | * @see {@link https://legacy.reactjs.org/docs/legacy-context.html Legacy React Docs}
|
1127 | */
|
1128 | contextTypes?: ValidationMap<any> | undefined;
|
1129 | /**
|
1130 | * Used to define default values for the props accepted by
|
1131 | * the component.
|
1132 | *
|
1133 | * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs}
|
1134 | *
|
1135 | * @example
|
1136 | *
|
1137 | * ```tsx
|
1138 | * type Props = { name?: string }
|
1139 | *
|
1140 | * const MyComponent: FC<Props> = (props) => {
|
1141 | * return <div>{props.name}</div>
|
1142 | * }
|
1143 | *
|
1144 | * MyComponent.defaultProps = {
|
1145 | * name: 'John Doe'
|
1146 | * }
|
1147 | * ```
|
1148 | */
|
1149 | defaultProps?: Partial<P> | undefined;
|
1150 | /**
|
1151 | * Used in debugging messages. You might want to set it
|
1152 | * explicitly if you want to display a different name for
|
1153 | * debugging purposes.
|
1154 | *
|
1155 | * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
|
1156 | *
|
1157 | * @example
|
1158 | *
|
1159 | * ```tsx
|
1160 | *
|
1161 | * const MyComponent: FC = () => {
|
1162 | * return <div>Hello!</div>
|
1163 | * }
|
1164 | *
|
1165 | * MyComponent.displayName = 'MyAwesomeComponent'
|
1166 | * ```
|
1167 | */
|
1168 | displayName?: string | undefined;
|
1169 | }
|
1170 |
|
1171 | /**
|
1172 | * @deprecated - Equivalent to {@link React.FunctionComponent}.
|
1173 | *
|
1174 | * @see {@link React.FunctionComponent}
|
1175 | * @alias {@link VoidFunctionComponent}
|
1176 | */
|
1177 | type VFC<P = {}> = VoidFunctionComponent<P>;
|
1178 |
|
1179 | /**
|
1180 | * @deprecated - Equivalent to {@link React.FunctionComponent}.
|
1181 | *
|
1182 | * @see {@link React.FunctionComponent}
|
1183 | */
|
1184 | interface VoidFunctionComponent<P = {}> {
|
1185 | (props: P, context?: any): ReactNode;
|
1186 | propTypes?: WeakValidationMap<P> | undefined;
|
1187 | contextTypes?: ValidationMap<any> | undefined;
|
1188 | defaultProps?: Partial<P> | undefined;
|
1189 | displayName?: string | undefined;
|
1190 | }
|
1191 |
|
1192 | /**
|
1193 | * The type of the ref received by a {@link ForwardRefRenderFunction}.
|
1194 | *
|
1195 | * @see {@link ForwardRefRenderFunction}
|
1196 | */
|
1197 | type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null;
|
1198 |
|
1199 | /**
|
1200 | * The type of the function passed to {@link forwardRef}. This is considered different
|
1201 | * to a normal {@link FunctionComponent} because it receives an additional argument,
|
1202 | *
|
1203 | * @param props Props passed to the component, if any.
|
1204 | * @param ref A ref forwarded to the component of type {@link ForwardedRef}.
|
1205 | *
|
1206 | * @template T The type of the forwarded ref.
|
1207 | * @template P The type of the props the component accepts.
|
1208 | *
|
1209 | * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet}
|
1210 | * @see {@link forwardRef}
|
1211 | */
|
1212 | interface ForwardRefRenderFunction<T, P = {}> {
|
1213 | (props: P, ref: ForwardedRef<T>): ReactNode;
|
1214 | /**
|
1215 | * Used in debugging messages. You might want to set it
|
1216 | * explicitly if you want to display a different name for
|
1217 | * debugging purposes.
|
1218 | *
|
1219 | * Will show `ForwardRef(${Component.displayName || Component.name})`
|
1220 | * in devtools by default, but can be given its own specific name.
|
1221 | *
|
1222 | * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
|
1223 | */
|
1224 | displayName?: string | undefined;
|
1225 | /**
|
1226 | * defaultProps are not supported on render functions passed to forwardRef.
|
1227 | *
|
1228 | * @see {@link https://github.com/microsoft/TypeScript/issues/36826 linked GitHub issue} for context
|
1229 | * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs}
|
1230 | */
|
1231 | defaultProps?: never | undefined;
|
1232 | /**
|
1233 | * propTypes are not supported on render functions passed to forwardRef.
|
1234 | *
|
1235 | * @see {@link https://github.com/microsoft/TypeScript/issues/36826 linked GitHub issue} for context
|
1236 | * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs}
|
1237 | */
|
1238 | propTypes?: never | undefined;
|
1239 | }
|
1240 |
|
1241 | /**
|
1242 | * Represents a component class in React.
|
1243 | *
|
1244 | * @template P The props the component accepts.
|
1245 | * @template S The internal state of the component.
|
1246 | */
|
1247 | interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
1248 | new(props: P, context?: any): Component<P, S>;
|
1249 | /**
|
1250 | * Used to declare the types of the props accepted by the
|
1251 | * component. These types will be checked during rendering
|
1252 | * and in development only.
|
1253 | *
|
1254 | * We recommend using TypeScript instead of checking prop
|
1255 | * types at runtime.
|
1256 | *
|
1257 | * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs}
|
1258 | */
|
1259 | propTypes?: WeakValidationMap<P> | undefined;
|
1260 | contextType?: Context<any> | undefined;
|
1261 | /**
|
1262 | * @deprecated use {@link ComponentClass.contextType} instead
|
1263 | *
|
1264 | * Lets you specify which legacy context is consumed by
|
1265 | * this component.
|
1266 | *
|
1267 | * @see {@link https://legacy.reactjs.org/docs/legacy-context.html Legacy React Docs}
|
1268 | */
|
1269 | contextTypes?: ValidationMap<any> | undefined;
|
1270 | /**
|
1271 | * @deprecated
|
1272 | *
|
1273 | * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#how-to-use-context Legacy React Docs}
|
1274 | */
|
1275 | childContextTypes?: ValidationMap<any> | undefined;
|
1276 | /**
|
1277 | * Used to define default values for the props accepted by
|
1278 | * the component.
|
1279 | *
|
1280 | * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs}
|
1281 | */
|
1282 | defaultProps?: Partial<P> | undefined;
|
1283 | /**
|
1284 | * Used in debugging messages. You might want to set it
|
1285 | * explicitly if you want to display a different name for
|
1286 | * debugging purposes.
|
1287 | *
|
1288 | * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs}
|
1289 | */
|
1290 | displayName?: string | undefined;
|
1291 | }
|
1292 |
|
1293 | /**
|
1294 | * @deprecated Use `ClassicComponentClass` from `create-react-class`
|
1295 | *
|
1296 | * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs}
|
1297 | * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm}
|
1298 | */
|
1299 | interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
|
1300 | new(props: P, context?: any): ClassicComponent<P, ComponentState>;
|
1301 | getDefaultProps?(): P;
|
1302 | }
|
1303 |
|
1304 | /**
|
1305 | * Used in {@link createElement} and {@link createFactory} to represent
|
1306 | * a class.
|
1307 | *
|
1308 | * An intersection type is used to infer multiple type parameters from
|
1309 | * a single argument, which is useful for many top-level API defs.
|
1310 | * See {@link https://github.com/Microsoft/TypeScript/issues/7234 this GitHub issue}
|
1311 | * for more info.
|
1312 | */
|
1313 | type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
1314 | & C
|
1315 | & (new(props: P, context?: any) => T);
|
1316 |
|
1317 | //
|
1318 | // Component Specs and Lifecycle
|
1319 | // ----------------------------------------------------------------------
|
1320 |
|
1321 | // This should actually be something like `Lifecycle<P, S> | DeprecatedLifecycle<P, S>`,
|
1322 | // as React will _not_ call the deprecated lifecycle methods if any of the new lifecycle
|
1323 | // methods are present.
|
1324 | interface ComponentLifecycle<P, S, SS = any> extends NewLifecycle<P, S, SS>, DeprecatedLifecycle<P, S> {
|
1325 | /**
|
1326 | * Called immediately after a component is mounted. Setting state here will trigger re-rendering.
|
1327 | */
|
1328 | componentDidMount?(): void;
|
1329 | /**
|
1330 | * Called to determine whether the change in props and state should trigger a re-render.
|
1331 | *
|
1332 | * `Component` always returns true.
|
1333 | * `PureComponent` implements a shallow comparison on props and state and returns true if any
|
1334 | * props or states have changed.
|
1335 | *
|
1336 | * If false is returned, {@link Component.render}, `componentWillUpdate`
|
1337 | * and `componentDidUpdate` will not be called.
|
1338 | */
|
1339 | shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean;
|
1340 | /**
|
1341 | * Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
|
1342 | * cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`.
|
1343 | */
|
1344 | componentWillUnmount?(): void;
|
1345 | /**
|
1346 | * Catches exceptions generated in descendant components. Unhandled exceptions will cause
|
1347 | * the entire component tree to unmount.
|
1348 | */
|
1349 | componentDidCatch?(error: Error, errorInfo: ErrorInfo): void;
|
1350 | }
|
1351 |
|
1352 | // Unfortunately, we have no way of declaring that the component constructor must implement this
|
1353 | interface StaticLifecycle<P, S> {
|
1354 | getDerivedStateFromProps?: GetDerivedStateFromProps<P, S> | undefined;
|
1355 | getDerivedStateFromError?: GetDerivedStateFromError<P, S> | undefined;
|
1356 | }
|
1357 |
|
1358 | type GetDerivedStateFromProps<P, S> =
|
1359 | /**
|
1360 | * Returns an update to a component's state based on its new props and old state.
|
1361 | *
|
1362 | * Note: its presence prevents any of the deprecated lifecycle methods from being invoked
|
1363 | */
|
1364 | (nextProps: Readonly<P>, prevState: S) => Partial<S> | null;
|
1365 |
|
1366 | type GetDerivedStateFromError<P, S> =
|
1367 | /**
|
1368 | * This lifecycle is invoked after an error has been thrown by a descendant component.
|
1369 | * It receives the error that was thrown as a parameter and should return a value to update state.
|
1370 | *
|
1371 | * Note: its presence prevents any of the deprecated lifecycle methods from being invoked
|
1372 | */
|
1373 | (error: any) => Partial<S> | null;
|
1374 |
|
1375 | // This should be "infer SS" but can't use it yet
|
1376 | interface NewLifecycle<P, S, SS> {
|
1377 | /**
|
1378 | * Runs before React applies the result of {@link Component.render render} to the document, and
|
1379 | * returns an object to be given to {@link componentDidUpdate}. Useful for saving
|
1380 | * things such as scroll position before {@link Component.render render} causes changes to it.
|
1381 | *
|
1382 | * Note: the presence of this method prevents any of the deprecated
|
1383 | * lifecycle events from running.
|
1384 | */
|
1385 | getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>): SS | null;
|
1386 | /**
|
1387 | * Called immediately after updating occurs. Not called for the initial render.
|
1388 | *
|
1389 | * The snapshot is only present if {@link getSnapshotBeforeUpdate} is present and returns non-null.
|
1390 | */
|
1391 | componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot?: SS): void;
|
1392 | }
|
1393 |
|
1394 | interface DeprecatedLifecycle<P, S> {
|
1395 | /**
|
1396 | * Called immediately before mounting occurs, and before {@link Component.render}.
|
1397 | * Avoid introducing any side-effects or subscriptions in this method.
|
1398 | *
|
1399 | * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
|
1400 | * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
|
1401 | * this from being invoked.
|
1402 | *
|
1403 | * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead; will stop working in React 17
|
1404 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state}
|
1405 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1406 | */
|
1407 | componentWillMount?(): void;
|
1408 | /**
|
1409 | * Called immediately before mounting occurs, and before {@link Component.render}.
|
1410 | * Avoid introducing any side-effects or subscriptions in this method.
|
1411 | *
|
1412 | * This method will not stop working in React 17.
|
1413 | *
|
1414 | * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
|
1415 | * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
|
1416 | * this from being invoked.
|
1417 | *
|
1418 | * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead
|
1419 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state}
|
1420 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1421 | */
|
1422 | UNSAFE_componentWillMount?(): void;
|
1423 | /**
|
1424 | * Called when the component may be receiving new props.
|
1425 | * React may call this even if props have not changed, so be sure to compare new and existing
|
1426 | * props if you only want to handle changes.
|
1427 | *
|
1428 | * Calling {@link Component.setState} generally does not trigger this method.
|
1429 | *
|
1430 | * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
|
1431 | * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
|
1432 | * this from being invoked.
|
1433 | *
|
1434 | * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead; will stop working in React 17
|
1435 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
|
1436 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1437 | */
|
1438 | componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
1439 | /**
|
1440 | * Called when the component may be receiving new props.
|
1441 | * React may call this even if props have not changed, so be sure to compare new and existing
|
1442 | * props if you only want to handle changes.
|
1443 | *
|
1444 | * Calling {@link Component.setState} generally does not trigger this method.
|
1445 | *
|
1446 | * This method will not stop working in React 17.
|
1447 | *
|
1448 | * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
|
1449 | * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
|
1450 | * this from being invoked.
|
1451 | *
|
1452 | * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead
|
1453 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
|
1454 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1455 | */
|
1456 | UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
1457 | /**
|
1458 | * Called immediately before rendering when new props or state is received. Not called for the initial render.
|
1459 | *
|
1460 | * Note: You cannot call {@link Component.setState} here.
|
1461 | *
|
1462 | * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
|
1463 | * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
|
1464 | * this from being invoked.
|
1465 | *
|
1466 | * @deprecated 16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17
|
1467 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
|
1468 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1469 | */
|
1470 | componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
1471 | /**
|
1472 | * Called immediately before rendering when new props or state is received. Not called for the initial render.
|
1473 | *
|
1474 | * Note: You cannot call {@link Component.setState} here.
|
1475 | *
|
1476 | * This method will not stop working in React 17.
|
1477 | *
|
1478 | * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate}
|
1479 | * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents
|
1480 | * this from being invoked.
|
1481 | *
|
1482 | * @deprecated 16.3, use getSnapshotBeforeUpdate instead
|
1483 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
|
1484 | * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1485 | */
|
1486 | UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
1487 | }
|
1488 |
|
1489 | /**
|
1490 | * @deprecated
|
1491 | *
|
1492 | * @see {@link https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html Mixins Considered Harmful}
|
1493 | */
|
1494 | interface Mixin<P, S> extends ComponentLifecycle<P, S> {
|
1495 | mixins?: Array<Mixin<P, S>> | undefined;
|
1496 | statics?: {
|
1497 | [key: string]: any;
|
1498 | } | undefined;
|
1499 |
|
1500 | displayName?: string | undefined;
|
1501 | propTypes?: ValidationMap<any> | undefined;
|
1502 | contextTypes?: ValidationMap<any> | undefined;
|
1503 | childContextTypes?: ValidationMap<any> | undefined;
|
1504 |
|
1505 | getDefaultProps?(): P;
|
1506 | getInitialState?(): S;
|
1507 | }
|
1508 |
|
1509 | /**
|
1510 | * @deprecated
|
1511 | *
|
1512 | * @see {@link https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html Mixins Considered Harmful}
|
1513 | */
|
1514 | interface ComponentSpec<P, S> extends Mixin<P, S> {
|
1515 | render(): ReactNode;
|
1516 |
|
1517 | [propertyName: string]: any;
|
1518 | }
|
1519 |
|
1520 | function createRef<T>(): RefObject<T>;
|
1521 |
|
1522 | /**
|
1523 | * The type of the component returned from {@link forwardRef}.
|
1524 | *
|
1525 | * @template P The props the component accepts, if any.
|
1526 | *
|
1527 | * @see {@link ExoticComponent}
|
1528 | */
|
1529 | interface ForwardRefExoticComponent<P> extends NamedExoticComponent<P> {
|
1530 | defaultProps?: Partial<P> | undefined;
|
1531 | propTypes?: WeakValidationMap<P> | undefined;
|
1532 | }
|
1533 |
|
1534 | /**
|
1535 | * Lets your component expose a DOM node to a parent component
|
1536 | * using a ref.
|
1537 | *
|
1538 | * @see {@link https://react.dev/reference/react/forwardRef React Docs}
|
1539 | * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet}
|
1540 | *
|
1541 | * @param render See the {@link ForwardRefRenderFunction}.
|
1542 | *
|
1543 | * @template T The type of the DOM node.
|
1544 | * @template P The props the component accepts, if any.
|
1545 | *
|
1546 | * @example
|
1547 | *
|
1548 | * ```tsx
|
1549 | * interface Props {
|
1550 | * children?: ReactNode;
|
1551 | * type: "submit" | "button";
|
1552 | * }
|
1553 | *
|
1554 | * export const FancyButton = forwardRef<HTMLButtonElement, Props>((props, ref) => (
|
1555 | * <button ref={ref} className="MyClassName" type={props.type}>
|
1556 | * {props.children}
|
1557 | * </button>
|
1558 | * ));
|
1559 | * ```
|
1560 | */
|
1561 | function forwardRef<T, P = {}>(
|
1562 | render: ForwardRefRenderFunction<T, P>,
|
1563 | ): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
|
1564 |
|
1565 | /**
|
1566 | * Omits the 'ref' attribute from the given props object.
|
1567 | *
|
1568 | * @template P The props object type.
|
1569 | */
|
1570 | type PropsWithoutRef<P> =
|
1571 | // Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
|
1572 | // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
|
1573 | // https://github.com/Microsoft/TypeScript/issues/28339
|
1574 | P extends any ? ("ref" extends keyof P ? Omit<P, "ref"> : P) : P;
|
1575 | /** Ensures that the props do not include string ref, which cannot be forwarded */
|
1576 | type PropsWithRef<P> =
|
1577 | // Note: String refs can be forwarded. We can't fix this bug without breaking a bunch of libraries now though.
|
1578 | // Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}.
|
1579 | "ref" extends keyof P
|
1580 | ? P extends { ref?: infer R | undefined }
|
1581 | ? string extends R ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
|
1582 | : P
|
1583 | : P
|
1584 | : P;
|
1585 |
|
1586 | type PropsWithChildren<P = unknown> = P & { children?: ReactNode | undefined };
|
1587 |
|
1588 | /**
|
1589 | * Used to retrieve the props a component accepts. Can either be passed a string,
|
1590 | * indicating a DOM element (e.g. 'div', 'span', etc.) or the type of a React
|
1591 | * component.
|
1592 | *
|
1593 | * It's usually better to use {@link ComponentPropsWithRef} or {@link ComponentPropsWithoutRef}
|
1594 | * instead of this type, as they let you be explicit about whether or not to include
|
1595 | * the `ref` prop.
|
1596 | *
|
1597 | * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
|
1598 | *
|
1599 | * @example
|
1600 | *
|
1601 | * ```tsx
|
1602 | * // Retrieves the props an 'input' element accepts
|
1603 | * type InputProps = React.ComponentProps<'input'>;
|
1604 | * ```
|
1605 | *
|
1606 | * @example
|
1607 | *
|
1608 | * ```tsx
|
1609 | * const MyComponent = (props: { foo: number, bar: string }) => <div />;
|
1610 | *
|
1611 | *
|
1612 | * type MyComponentProps = React.ComponentProps<typeof MyComponent>;
|
1613 | * ```
|
1614 | */
|
1615 | type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends
|
1616 | JSXElementConstructor<infer P> ? P
|
1617 | : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T]
|
1618 | : {};
|
1619 |
|
1620 | /**
|
1621 | * Used to retrieve the props a component accepts with its ref. Can either be
|
1622 | * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
|
1623 | * type of a React component.
|
1624 | *
|
1625 | * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
|
1626 | *
|
1627 | * @example
|
1628 | *
|
1629 | * ```tsx
|
1630 | *
|
1631 | * type InputProps = React.ComponentPropsWithRef<'input'>;
|
1632 | * ```
|
1633 | *
|
1634 | * @example
|
1635 | *
|
1636 | * ```tsx
|
1637 | * const MyComponent = (props: { foo: number, bar: string }) => <div />;
|
1638 | *
|
1639 | *
|
1640 | * type MyComponentPropsWithRef = React.ComponentPropsWithRef<typeof MyComponent>;
|
1641 | * ```
|
1642 | */
|
1643 | type ComponentPropsWithRef<T extends ElementType> = T extends (new(props: infer P) => Component<any, any>)
|
1644 | ? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
|
1645 | : PropsWithRef<ComponentProps<T>>;
|
1646 | /**
|
1647 | * Used to retrieve the props a custom component accepts with its ref.
|
1648 | *
|
1649 | * Unlike {@link ComponentPropsWithRef}, this only works with custom
|
1650 | * components, i.e. components you define yourself. This is to improve
|
1651 | * type-checking performance.
|
1652 | *
|
1653 | * @example
|
1654 | *
|
1655 | * ```tsx
|
1656 | * const MyComponent = (props: { foo: number, bar: string }) => <div />;
|
1657 | *
|
1658 | *
|
1659 | * type MyComponentPropsWithRef = React.CustomComponentPropsWithRef<typeof MyComponent>;
|
1660 | * ```
|
1661 | */
|
1662 | type CustomComponentPropsWithRef<T extends ComponentType> = T extends (new(props: infer P) => Component<any, any>)
|
1663 | ? (PropsWithoutRef<P> & RefAttributes<InstanceType<T>>)
|
1664 | : T extends ((props: infer P, legacyContext?: any) => ReactNode) ? PropsWithRef<P>
|
1665 | : never;
|
1666 |
|
1667 | /**
|
1668 | * Used to retrieve the props a component accepts without its ref. Can either be
|
1669 | * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the
|
1670 | * type of a React component.
|
1671 | *
|
1672 | * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet}
|
1673 | *
|
1674 | * @example
|
1675 | *
|
1676 | * ```tsx
|
1677 | *
|
1678 | * type InputProps = React.ComponentPropsWithoutRef<'input'>;
|
1679 | * ```
|
1680 | *
|
1681 | * @example
|
1682 | *
|
1683 | * ```tsx
|
1684 | * const MyComponent = (props: { foo: number, bar: string }) => <div />;
|
1685 | *
|
1686 | *
|
1687 | * type MyComponentPropsWithoutRef = React.ComponentPropsWithoutRef<typeof MyComponent>;
|
1688 | * ```
|
1689 | */
|
1690 | type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;
|
1691 |
|
1692 | type ComponentRef<T extends ElementType> = T extends NamedExoticComponent<
|
1693 | ComponentPropsWithoutRef<T> & RefAttributes<infer Method>
|
1694 | > ? Method
|
1695 | : ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
|
1696 | : never;
|
1697 |
|
1698 | // will show `Memo(${Component.displayName || Component.name})` in devtools by default,
|
1699 | // but can be given its own specific name
|
1700 | type MemoExoticComponent<T extends ComponentType<any>> = NamedExoticComponent<CustomComponentPropsWithRef<T>> & {
|
1701 | readonly type: T;
|
1702 | };
|
1703 |
|
1704 | /**
|
1705 | * Lets you skip re-rendering a component when its props are unchanged.
|
1706 | *
|
1707 | * @see {@link https://react.dev/reference/react/memo React Docs}
|
1708 | *
|
1709 | * @param Component The component to memoize.
|
1710 | * @param propsAreEqual A function that will be used to determine if the props have changed.
|
1711 | *
|
1712 | * @example
|
1713 | *
|
1714 | * ```tsx
|
1715 | * import { memo } from 'react';
|
1716 | *
|
1717 | * const SomeComponent = memo(function SomeComponent(props: { foo: string }) {
|
1718 | *
|
1719 | * });
|
1720 | * ```
|
1721 | */
|
1722 | function memo<P extends object>(
|
1723 | Component: FunctionComponent<P>,
|
1724 | propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean,
|
1725 | ): NamedExoticComponent<P>;
|
1726 | function memo<T extends ComponentType<any>>(
|
1727 | Component: T,
|
1728 | propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean,
|
1729 | ): MemoExoticComponent<T>;
|
1730 |
|
1731 | interface LazyExoticComponent<T extends ComponentType<any>>
|
1732 | extends ExoticComponent<CustomComponentPropsWithRef<T>>
|
1733 | {
|
1734 | readonly _result: T;
|
1735 | }
|
1736 |
|
1737 | /**
|
1738 | * Lets you defer loading a component’s code until it is rendered for the first time.
|
1739 | *
|
1740 | * @see {@link https://react.dev/reference/react/lazy React Docs}
|
1741 | *
|
1742 | * @param load A function that returns a `Promise` or another thenable (a `Promise`-like object with a
|
1743 | * then method). React will not call `load` until the first time you attempt to render the returned
|
1744 | * component. After React first calls load, it will wait for it to resolve, and then render the
|
1745 | * resolved value’s `.default` as a React component. Both the returned `Promise` and the `Promise`’s
|
1746 | * resolved value will be cached, so React will not call load more than once. If the `Promise` rejects,
|
1747 | * React will throw the rejection reason for the nearest Error Boundary to handle.
|
1748 | *
|
1749 | * @example
|
1750 | *
|
1751 | * ```tsx
|
1752 | * import { lazy } from 'react';
|
1753 | *
|
1754 | * const MarkdownPreview = lazy(() => import('./MarkdownPreview.js'));
|
1755 | * ```
|
1756 | */
|
1757 | function lazy<T extends ComponentType<any>>(
|
1758 | load: () => Promise<{ default: T }>,
|
1759 | ): LazyExoticComponent<T>;
|
1760 |
|
1761 | //
|
1762 | // React Hooks
|
1763 | // ----------------------------------------------------------------------
|
1764 |
|
1765 | /**
|
1766 | * The instruction passed to a {@link Dispatch} function in {@link useState}
|
1767 | * to tell React what the next value of the {@link useState} should be.
|
1768 | *
|
1769 | * Often found wrapped in {@link Dispatch}.
|
1770 | *
|
1771 | * @template S The type of the state.
|
1772 | *
|
1773 | * @example
|
1774 | *
|
1775 | * ```tsx
|
1776 | *
|
1777 | *
|
1778 | * const useCustomState = (): Dispatch<SetStateAction<number>> => {
|
1779 | * const [count, setCount] = useState(0);
|
1780 | *
|
1781 | * return setCount;
|
1782 | * }
|
1783 | * ```
|
1784 | */
|
1785 | type SetStateAction<S> = S | ((prevState: S) => S);
|
1786 |
|
1787 | /**
|
1788 | * A function that can be used to update the state of a {@link useState}
|
1789 | * or {@link useReducer} hook.
|
1790 | */
|
1791 | type Dispatch<A> = (value: A) => void;
|
1792 | /**
|
1793 | * A {@link Dispatch} function can sometimes be called without any arguments.
|
1794 | */
|
1795 | type DispatchWithoutAction = () => void;
|
1796 | // Unlike redux, the actions _can_ be anything
|
1797 | type Reducer<S, A> = (prevState: S, action: A) => S;
|
1798 | // If useReducer accepts a reducer without action, dispatch may be called without any parameters.
|
1799 | type ReducerWithoutAction<S> = (prevState: S) => S;
|
1800 | // types used to try and prevent the compiler from reducing S
|
1801 | // to a supertype common with the second argument to useReducer()
|
1802 | type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
|
1803 | type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never;
|
1804 | // The identity check is done with the SameValue algorithm (Object.is), which is stricter than ===
|
1805 | type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> = R extends ReducerWithoutAction<infer S> ? S
|
1806 | : never;
|
1807 | type DependencyList = readonly unknown[];
|
1808 |
|
1809 | // NOTE: callbacks are _only_ allowed to return either void, or a destructor.
|
1810 | type EffectCallback = () => void | Destructor;
|
1811 |
|
1812 | interface MutableRefObject<T> {
|
1813 | current: T;
|
1814 | }
|
1815 |
|
1816 | // This will technically work if you give a Consumer<T> or Provider<T> but it's deprecated and warns
|
1817 | /**
|
1818 | * Accepts a context object (the value returned from `React.createContext`) and returns the current
|
1819 | * context value, as given by the nearest context provider for the given context.
|
1820 | *
|
1821 | * @version 16.8.0
|
1822 | * @see {@link https://react.dev/reference/react/useContext}
|
1823 | */
|
1824 | function useContext<T>(context: Context<T> /*, (not public API) observedBits?: number|boolean */): T;
|
1825 | /**
|
1826 | * Returns a stateful value, and a function to update it.
|
1827 | *
|
1828 | * @version 16.8.0
|
1829 | * @see {@link https://react.dev/reference/react/useState}
|
1830 | */
|
1831 | function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>];
|
1832 | // convenience overload when first argument is omitted
|
1833 | /**
|
1834 | * Returns a stateful value, and a function to update it.
|
1835 | *
|
1836 | * @version 16.8.0
|
1837 | * @see {@link https://react.dev/reference/react/useState}
|
1838 | */
|
1839 | function useState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>];
|
1840 | /**
|
1841 | * An alternative to `useState`.
|
1842 | *
|
1843 | * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
1844 | * multiple sub-values. It also lets you optimize performance for components that trigger deep
|
1845 | * updates because you can pass `dispatch` down instead of callbacks.
|
1846 | *
|
1847 | * @version 16.8.0
|
1848 | * @see {@link https://react.dev/reference/react/useReducer}
|
1849 | */
|
1850 | // overload where dispatch could accept 0 arguments.
|
1851 | function useReducer<R extends ReducerWithoutAction<any>, I>(
|
1852 | reducer: R,
|
1853 | initializerArg: I,
|
1854 | initializer: (arg: I) => ReducerStateWithoutAction<R>,
|
1855 | ): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
|
1856 | /**
|
1857 | * An alternative to `useState`.
|
1858 | *
|
1859 | * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
1860 | * multiple sub-values. It also lets you optimize performance for components that trigger deep
|
1861 | * updates because you can pass `dispatch` down instead of callbacks.
|
1862 | *
|
1863 | * @version 16.8.0
|
1864 | * @see {@link https://react.dev/reference/react/useReducer}
|
1865 | */
|
1866 | // overload where dispatch could accept 0 arguments.
|
1867 | function useReducer<R extends ReducerWithoutAction<any>>(
|
1868 | reducer: R,
|
1869 | initializerArg: ReducerStateWithoutAction<R>,
|
1870 | initializer?: undefined,
|
1871 | ): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
|
1872 | /**
|
1873 | * An alternative to `useState`.
|
1874 | *
|
1875 | * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
1876 | * multiple sub-values. It also lets you optimize performance for components that trigger deep
|
1877 | * updates because you can pass `dispatch` down instead of callbacks.
|
1878 | *
|
1879 | * @version 16.8.0
|
1880 | * @see {@link https://react.dev/reference/react/useReducer}
|
1881 | */
|
1882 | // overload where "I" may be a subset of ReducerState<R>; used to provide autocompletion.
|
1883 | // If "I" matches ReducerState<R> exactly then the last overload will allow initializer to be omitted.
|
1884 | // the last overload effectively behaves as if the identity function (x => x) is the initializer.
|
1885 | function useReducer<R extends Reducer<any, any>, I>(
|
1886 | reducer: R,
|
1887 | initializerArg: I & ReducerState<R>,
|
1888 | initializer: (arg: I & ReducerState<R>) => ReducerState<R>,
|
1889 | ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
|
1890 | /**
|
1891 | * An alternative to `useState`.
|
1892 | *
|
1893 | * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
1894 | * multiple sub-values. It also lets you optimize performance for components that trigger deep
|
1895 | * updates because you can pass `dispatch` down instead of callbacks.
|
1896 | *
|
1897 | * @version 16.8.0
|
1898 | * @see {@link https://react.dev/reference/react/useReducer}
|
1899 | */
|
1900 | // overload for free "I"; all goes as long as initializer converts it into "ReducerState<R>".
|
1901 | function useReducer<R extends Reducer<any, any>, I>(
|
1902 | reducer: R,
|
1903 | initializerArg: I,
|
1904 | initializer: (arg: I) => ReducerState<R>,
|
1905 | ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
|
1906 | /**
|
1907 | * An alternative to `useState`.
|
1908 | *
|
1909 | * `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
1910 | * multiple sub-values. It also lets you optimize performance for components that trigger deep
|
1911 | * updates because you can pass `dispatch` down instead of callbacks.
|
1912 | *
|
1913 | * @version 16.8.0
|
1914 | * @see {@link https://react.dev/reference/react/useReducer}
|
1915 | */
|
1916 |
|
1917 | // I'm not sure if I keep this 2-ary or if I make it (2,3)-ary; it's currently (2,3)-ary.
|
1918 | // The Flow types do have an overload for 3-ary invocation with undefined initializer.
|
1919 |
|
1920 | // NOTE: without the ReducerState indirection, TypeScript would reduce S to be the most common
|
1921 | // supertype between the reducer's return type and the initialState (or the initializer's return type),
|
1922 | // which would prevent autocompletion from ever working.
|
1923 |
|
1924 | // TODO: double-check if this weird overload logic is necessary. It is possible it's either a bug
|
1925 | // in older versions, or a regression in newer versions of the typescript completion service.
|
1926 | function useReducer<R extends Reducer<any, any>>(
|
1927 | reducer: R,
|
1928 | initialState: ReducerState<R>,
|
1929 | initializer?: undefined,
|
1930 | ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
|
1931 | /**
|
1932 | * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
|
1933 | * (`initialValue`). The returned object will persist for the full lifetime of the component.
|
1934 | *
|
1935 | * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
|
1936 | * value around similar to how you’d use instance fields in classes.
|
1937 | *
|
1938 | * @version 16.8.0
|
1939 | * @see {@link https://react.dev/reference/react/useRef}
|
1940 | */
|
1941 | function useRef<T>(initialValue: T): MutableRefObject<T>;
|
1942 | // convenience overload for refs given as a ref prop as they typically start with a null value
|
1943 | /**
|
1944 | * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
|
1945 | * (`initialValue`). The returned object will persist for the full lifetime of the component.
|
1946 | *
|
1947 | * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
|
1948 | * value around similar to how you’d use instance fields in classes.
|
1949 | *
|
1950 | * Usage note: if you need the result of useRef to be directly mutable, include `| null` in the type
|
1951 | * of the generic argument.
|
1952 | *
|
1953 | * @version 16.8.0
|
1954 | * @see {@link https://react.dev/reference/react/useRef}
|
1955 | */
|
1956 | function useRef<T>(initialValue: T | null): RefObject<T>;
|
1957 | // convenience overload for potentially undefined initialValue / call with 0 arguments
|
1958 | // has a default to stop it from defaulting to {} instead
|
1959 | /**
|
1960 | * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
|
1961 | * (`initialValue`). The returned object will persist for the full lifetime of the component.
|
1962 | *
|
1963 | * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
|
1964 | * value around similar to how you’d use instance fields in classes.
|
1965 | *
|
1966 | * @version 16.8.0
|
1967 | * @see {@link https://react.dev/reference/react/useRef}
|
1968 | */
|
1969 | function useRef<T = undefined>(): MutableRefObject<T | undefined>;
|
1970 | /**
|
1971 | * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations.
|
1972 | * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside
|
1973 | * `useLayoutEffect` will be flushed synchronously, before the browser has a chance to paint.
|
1974 | *
|
1975 | * Prefer the standard `useEffect` when possible to avoid blocking visual updates.
|
1976 | *
|
1977 | * If you’re migrating code from a class component, `useLayoutEffect` fires in the same phase as
|
1978 | * `componentDidMount` and `componentDidUpdate`.
|
1979 | *
|
1980 | * @version 16.8.0
|
1981 | * @see {@link https://react.dev/reference/react/useLayoutEffect}
|
1982 | */
|
1983 | function useLayoutEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1984 | /**
|
1985 | * Accepts a function that contains imperative, possibly effectful code.
|
1986 | *
|
1987 | * @param effect Imperative function that can return a cleanup function
|
1988 | * @param deps If present, effect will only activate if the values in the list change.
|
1989 | *
|
1990 | * @version 16.8.0
|
1991 | * @see {@link https://react.dev/reference/react/useEffect}
|
1992 | */
|
1993 | function useEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1994 | // NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T>
|
1995 | /**
|
1996 | * `useImperativeHandle` customizes the instance value that is exposed to parent components when using
|
1997 | * `ref`. As always, imperative code using refs should be avoided in most cases.
|
1998 | *
|
1999 | * `useImperativeHandle` should be used with `React.forwardRef`.
|
2000 | *
|
2001 | * @version 16.8.0
|
2002 | * @see {@link https://react.dev/reference/react/useImperativeHandle}
|
2003 | */
|
2004 | function useImperativeHandle<T, R extends T>(ref: Ref<T> | undefined, init: () => R, deps?: DependencyList): void;
|
2005 | // I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key
|
2006 | // useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y.
|
2007 | /**
|
2008 | * `useCallback` will return a memoized version of the callback that only changes if one of the `inputs`
|
2009 | * has changed.
|
2010 | *
|
2011 | * @version 16.8.0
|
2012 | * @see {@link https://react.dev/reference/react/useCallback}
|
2013 | */
|
2014 | // A specific function type would not trigger implicit any.
|
2015 | // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types.
|
2016 | // eslint-disable-next-line @typescript-eslint/ban-types
|
2017 | function useCallback<T extends Function>(callback: T, deps: DependencyList): T;
|
2018 | /**
|
2019 | * `useMemo` will only recompute the memoized value when one of the `deps` has changed.
|
2020 | *
|
2021 | * @version 16.8.0
|
2022 | * @see {@link https://react.dev/reference/react/useMemo}
|
2023 | */
|
2024 | // allow undefined, but don't make it optional as that is very likely a mistake
|
2025 | function useMemo<T>(factory: () => T, deps: DependencyList): T;
|
2026 | /**
|
2027 | * `useDebugValue` can be used to display a label for custom hooks in React DevTools.
|
2028 | *
|
2029 | * NOTE: We don’t recommend adding debug values to every custom hook.
|
2030 | * It’s most valuable for custom hooks that are part of shared libraries.
|
2031 | *
|
2032 | * @version 16.8.0
|
2033 | * @see {@link https://react.dev/reference/react/useDebugValue}
|
2034 | */
|
2035 | // the name of the custom hook is itself derived from the function name at runtime:
|
2036 | // it's just the function name without the "use" prefix.
|
2037 | function useDebugValue<T>(value: T, format?: (value: T) => any): void;
|
2038 |
|
2039 | // must be synchronous
|
2040 | export type TransitionFunction = () => VoidOrUndefinedOnly;
|
2041 | // strange definition to allow vscode to show documentation on the invocation
|
2042 | export interface TransitionStartFunction {
|
2043 | /**
|
2044 | * State updates caused inside the callback are allowed to be deferred.
|
2045 | *
|
2046 | * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
2047 | *
|
2048 | * @param callback A _synchronous_ function which causes state updates that can be deferred.
|
2049 | */
|
2050 | (callback: TransitionFunction): void;
|
2051 | }
|
2052 |
|
2053 | /**
|
2054 | * Returns a deferred version of the value that may “lag behind” it.
|
2055 | *
|
2056 | * This is commonly used to keep the interface responsive when you have something that renders immediately
|
2057 | * based on user input and something that needs to wait for a data fetch.
|
2058 | *
|
2059 | * A good example of this is a text input.
|
2060 | *
|
2061 | * @param value The value that is going to be deferred
|
2062 | *
|
2063 | * @see {@link https://react.dev/reference/react/useDeferredValue}
|
2064 | */
|
2065 | export function useDeferredValue<T>(value: T): T;
|
2066 |
|
2067 | /**
|
2068 | * Allows components to avoid undesirable loading states by waiting for content to load
|
2069 | * before transitioning to the next screen. It also allows components to defer slower,
|
2070 | * data fetching updates until subsequent renders so that more crucial updates can be
|
2071 | * rendered immediately.
|
2072 | *
|
2073 | * The `useTransition` hook returns two values in an array.
|
2074 | *
|
2075 | * The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish.
|
2076 | * The second is a function that takes a callback. We can use it to tell React which state we want to defer.
|
2077 | *
|
2078 | * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
2079 | *
|
2080 | * @see {@link https://react.dev/reference/react/useTransition}
|
2081 | */
|
2082 | export function useTransition(): [boolean, TransitionStartFunction];
|
2083 |
|
2084 | /**
|
2085 | * Similar to `useTransition` but allows uses where hooks are not available.
|
2086 | *
|
2087 | * @param callback A _synchronous_ function which causes state updates that can be deferred.
|
2088 | */
|
2089 | export function startTransition(scope: TransitionFunction): void;
|
2090 |
|
2091 | export function useId(): string;
|
2092 |
|
2093 | /**
|
2094 | * @param effect Imperative function that can return a cleanup function
|
2095 | * @param deps If present, effect will only activate if the values in the list change.
|
2096 | *
|
2097 | * @see {@link https://github.com/facebook/react/pull/21913}
|
2098 | */
|
2099 | export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
|
2100 |
|
2101 | /**
|
2102 | * @param subscribe
|
2103 | * @param getSnapshot
|
2104 | *
|
2105 | * @see {@link https://github.com/reactwg/react-18/discussions/86}
|
2106 | */
|
2107 | // keep in sync with `useSyncExternalStore` from `use-sync-external-store`
|
2108 | export function useSyncExternalStore<Snapshot>(
|
2109 | subscribe: (onStoreChange: () => void) => () => void,
|
2110 | getSnapshot: () => Snapshot,
|
2111 | getServerSnapshot?: () => Snapshot,
|
2112 | ): Snapshot;
|
2113 |
|
2114 | //
|
2115 | // Event System
|
2116 | // ----------------------------------------------------------------------
|
2117 | // TODO: change any to unknown when moving to TS v3
|
2118 | interface BaseSyntheticEvent<E = object, C = any, T = any> {
|
2119 | nativeEvent: E;
|
2120 | currentTarget: C;
|
2121 | target: T;
|
2122 | bubbles: boolean;
|
2123 | cancelable: boolean;
|
2124 | defaultPrevented: boolean;
|
2125 | eventPhase: number;
|
2126 | isTrusted: boolean;
|
2127 | preventDefault(): void;
|
2128 | isDefaultPrevented(): boolean;
|
2129 | stopPropagation(): void;
|
2130 | isPropagationStopped(): boolean;
|
2131 | persist(): void;
|
2132 | timeStamp: number;
|
2133 | type: string;
|
2134 | }
|
2135 |
|
2136 | /**
|
2137 | * currentTarget - a reference to the element on which the event listener is registered.
|
2138 | *
|
2139 | * target - a reference to the element from which the event was originally dispatched.
|
2140 | * This might be a child element to the element on which the event listener is registered.
|
2141 | * If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682
|
2142 | */
|
2143 | interface SyntheticEvent<T = Element, E = Event> extends BaseSyntheticEvent<E, EventTarget & T, EventTarget> {}
|
2144 |
|
2145 | interface ClipboardEvent<T = Element> extends SyntheticEvent<T, NativeClipboardEvent> {
|
2146 | clipboardData: DataTransfer;
|
2147 | }
|
2148 |
|
2149 | interface CompositionEvent<T = Element> extends SyntheticEvent<T, NativeCompositionEvent> {
|
2150 | data: string;
|
2151 | }
|
2152 |
|
2153 | interface DragEvent<T = Element> extends MouseEvent<T, NativeDragEvent> {
|
2154 | dataTransfer: DataTransfer;
|
2155 | }
|
2156 |
|
2157 | interface PointerEvent<T = Element> extends MouseEvent<T, NativePointerEvent> {
|
2158 | pointerId: number;
|
2159 | pressure: number;
|
2160 | tangentialPressure: number;
|
2161 | tiltX: number;
|
2162 | tiltY: number;
|
2163 | twist: number;
|
2164 | width: number;
|
2165 | height: number;
|
2166 | pointerType: "mouse" | "pen" | "touch";
|
2167 | isPrimary: boolean;
|
2168 | }
|
2169 |
|
2170 | interface FocusEvent<Target = Element, RelatedTarget = Element> extends SyntheticEvent<Target, NativeFocusEvent> {
|
2171 | relatedTarget: (EventTarget & RelatedTarget) | null;
|
2172 | target: EventTarget & Target;
|
2173 | }
|
2174 |
|
2175 | interface FormEvent<T = Element> extends SyntheticEvent<T> {
|
2176 | }
|
2177 |
|
2178 | interface InvalidEvent<T = Element> extends SyntheticEvent<T> {
|
2179 | target: EventTarget & T;
|
2180 | }
|
2181 |
|
2182 | interface ChangeEvent<T = Element> extends SyntheticEvent<T> {
|
2183 | target: EventTarget & T;
|
2184 | }
|
2185 |
|
2186 | export type ModifierKey =
|
2187 | | "Alt"
|
2188 | | "AltGraph"
|
2189 | | "CapsLock"
|
2190 | | "Control"
|
2191 | | "Fn"
|
2192 | | "FnLock"
|
2193 | | "Hyper"
|
2194 | | "Meta"
|
2195 | | "NumLock"
|
2196 | | "ScrollLock"
|
2197 | | "Shift"
|
2198 | | "Super"
|
2199 | | "Symbol"
|
2200 | | "SymbolLock";
|
2201 |
|
2202 | interface KeyboardEvent<T = Element> extends UIEvent<T, NativeKeyboardEvent> {
|
2203 | altKey: boolean;
|
2204 | /** @deprecated */
|
2205 | charCode: number;
|
2206 | ctrlKey: boolean;
|
2207 | code: string;
|
2208 | /**
|
2209 | * 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.
|
2210 | */
|
2211 | getModifierState(key: ModifierKey): boolean;
|
2212 | /**
|
2213 | * See the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values). for possible values
|
2214 | */
|
2215 | key: string;
|
2216 | /** @deprecated */
|
2217 | keyCode: number;
|
2218 | locale: string;
|
2219 | location: number;
|
2220 | metaKey: boolean;
|
2221 | repeat: boolean;
|
2222 | shiftKey: boolean;
|
2223 | /** @deprecated */
|
2224 | which: number;
|
2225 | }
|
2226 |
|
2227 | interface MouseEvent<T = Element, E = NativeMouseEvent> extends UIEvent<T, E> {
|
2228 | altKey: boolean;
|
2229 | button: number;
|
2230 | buttons: number;
|
2231 | clientX: number;
|
2232 | clientY: number;
|
2233 | ctrlKey: boolean;
|
2234 | /**
|
2235 | * 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.
|
2236 | */
|
2237 | getModifierState(key: ModifierKey): boolean;
|
2238 | metaKey: boolean;
|
2239 | movementX: number;
|
2240 | movementY: number;
|
2241 | pageX: number;
|
2242 | pageY: number;
|
2243 | relatedTarget: EventTarget | null;
|
2244 | screenX: number;
|
2245 | screenY: number;
|
2246 | shiftKey: boolean;
|
2247 | }
|
2248 |
|
2249 | interface TouchEvent<T = Element> extends UIEvent<T, NativeTouchEvent> {
|
2250 | altKey: boolean;
|
2251 | changedTouches: TouchList;
|
2252 | ctrlKey: boolean;
|
2253 | /**
|
2254 | * 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.
|
2255 | */
|
2256 | getModifierState(key: ModifierKey): boolean;
|
2257 | metaKey: boolean;
|
2258 | shiftKey: boolean;
|
2259 | targetTouches: TouchList;
|
2260 | touches: TouchList;
|
2261 | }
|
2262 |
|
2263 | interface UIEvent<T = Element, E = NativeUIEvent> extends SyntheticEvent<T, E> {
|
2264 | detail: number;
|
2265 | view: AbstractView;
|
2266 | }
|
2267 |
|
2268 | interface WheelEvent<T = Element> extends MouseEvent<T, NativeWheelEvent> {
|
2269 | deltaMode: number;
|
2270 | deltaX: number;
|
2271 | deltaY: number;
|
2272 | deltaZ: number;
|
2273 | }
|
2274 |
|
2275 | interface AnimationEvent<T = Element> extends SyntheticEvent<T, NativeAnimationEvent> {
|
2276 | animationName: string;
|
2277 | elapsedTime: number;
|
2278 | pseudoElement: string;
|
2279 | }
|
2280 |
|
2281 | interface TransitionEvent<T = Element> extends SyntheticEvent<T, NativeTransitionEvent> {
|
2282 | elapsedTime: number;
|
2283 | propertyName: string;
|
2284 | pseudoElement: string;
|
2285 | }
|
2286 |
|
2287 | //
|
2288 | // Event Handler Types
|
2289 | // ----------------------------------------------------------------------
|
2290 |
|
2291 | type EventHandler<E extends SyntheticEvent<any>> = { bivarianceHack(event: E): void }["bivarianceHack"];
|
2292 |
|
2293 | type ReactEventHandler<T = Element> = EventHandler<SyntheticEvent<T>>;
|
2294 |
|
2295 | type ClipboardEventHandler<T = Element> = EventHandler<ClipboardEvent<T>>;
|
2296 | type CompositionEventHandler<T = Element> = EventHandler<CompositionEvent<T>>;
|
2297 | type DragEventHandler<T = Element> = EventHandler<DragEvent<T>>;
|
2298 | type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
|
2299 | type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
|
2300 | type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
|
2301 | type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
|
2302 | type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
|
2303 | type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
|
2304 | type PointerEventHandler<T = Element> = EventHandler<PointerEvent<T>>;
|
2305 | type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>;
|
2306 | type WheelEventHandler<T = Element> = EventHandler<WheelEvent<T>>;
|
2307 | type AnimationEventHandler<T = Element> = EventHandler<AnimationEvent<T>>;
|
2308 | type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent<T>>;
|
2309 |
|
2310 | //
|
2311 | // Props / DOM Attributes
|
2312 | // ----------------------------------------------------------------------
|
2313 |
|
2314 | interface HTMLProps<T> extends AllHTMLAttributes<T>, ClassAttributes<T> {
|
2315 | }
|
2316 |
|
2317 | type DetailedHTMLProps<E extends HTMLAttributes<T>, T> = ClassAttributes<T> & E;
|
2318 |
|
2319 | interface SVGProps<T> extends SVGAttributes<T>, ClassAttributes<T> {
|
2320 | }
|
2321 |
|
2322 | interface SVGLineElementAttributes<T> extends SVGProps<T> {}
|
2323 | interface SVGTextElementAttributes<T> extends SVGProps<T> {}
|
2324 |
|
2325 | interface DOMAttributes<T> {
|
2326 | children?: ReactNode | undefined;
|
2327 | dangerouslySetInnerHTML?: {
|
2328 | // Should be InnerHTML['innerHTML'].
|
2329 | // But unfortunately we're mixing renderer-specific type declarations.
|
2330 | __html: string | TrustedHTML;
|
2331 | } | undefined;
|
2332 |
|
2333 | // Clipboard Events
|
2334 | onCopy?: ClipboardEventHandler<T> | undefined;
|
2335 | onCopyCapture?: ClipboardEventHandler<T> | undefined;
|
2336 | onCut?: ClipboardEventHandler<T> | undefined;
|
2337 | onCutCapture?: ClipboardEventHandler<T> | undefined;
|
2338 | onPaste?: ClipboardEventHandler<T> | undefined;
|
2339 | onPasteCapture?: ClipboardEventHandler<T> | undefined;
|
2340 |
|
2341 | // Composition Events
|
2342 | onCompositionEnd?: CompositionEventHandler<T> | undefined;
|
2343 | onCompositionEndCapture?: CompositionEventHandler<T> | undefined;
|
2344 | onCompositionStart?: CompositionEventHandler<T> | undefined;
|
2345 | onCompositionStartCapture?: CompositionEventHandler<T> | undefined;
|
2346 | onCompositionUpdate?: CompositionEventHandler<T> | undefined;
|
2347 | onCompositionUpdateCapture?: CompositionEventHandler<T> | undefined;
|
2348 |
|
2349 | // Focus Events
|
2350 | onFocus?: FocusEventHandler<T> | undefined;
|
2351 | onFocusCapture?: FocusEventHandler<T> | undefined;
|
2352 | onBlur?: FocusEventHandler<T> | undefined;
|
2353 | onBlurCapture?: FocusEventHandler<T> | undefined;
|
2354 |
|
2355 | // Form Events
|
2356 | onChange?: FormEventHandler<T> | undefined;
|
2357 | onChangeCapture?: FormEventHandler<T> | undefined;
|
2358 | onBeforeInput?: FormEventHandler<T> | undefined;
|
2359 | onBeforeInputCapture?: FormEventHandler<T> | undefined;
|
2360 | onInput?: FormEventHandler<T> | undefined;
|
2361 | onInputCapture?: FormEventHandler<T> | undefined;
|
2362 | onReset?: FormEventHandler<T> | undefined;
|
2363 | onResetCapture?: FormEventHandler<T> | undefined;
|
2364 | onSubmit?: FormEventHandler<T> | undefined;
|
2365 | onSubmitCapture?: FormEventHandler<T> | undefined;
|
2366 | onInvalid?: FormEventHandler<T> | undefined;
|
2367 | onInvalidCapture?: FormEventHandler<T> | undefined;
|
2368 |
|
2369 | // Image Events
|
2370 | onLoad?: ReactEventHandler<T> | undefined;
|
2371 | onLoadCapture?: ReactEventHandler<T> | undefined;
|
2372 | onError?: ReactEventHandler<T> | undefined; // also a Media Event
|
2373 | onErrorCapture?: ReactEventHandler<T> | undefined; // also a Media Event
|
2374 |
|
2375 | // Keyboard Events
|
2376 | onKeyDown?: KeyboardEventHandler<T> | undefined;
|
2377 | onKeyDownCapture?: KeyboardEventHandler<T> | undefined;
|
2378 | /** @deprecated */
|
2379 | onKeyPress?: KeyboardEventHandler<T> | undefined;
|
2380 | /** @deprecated */
|
2381 | onKeyPressCapture?: KeyboardEventHandler<T> | undefined;
|
2382 | onKeyUp?: KeyboardEventHandler<T> | undefined;
|
2383 | onKeyUpCapture?: KeyboardEventHandler<T> | undefined;
|
2384 |
|
2385 | // Media Events
|
2386 | onAbort?: ReactEventHandler<T> | undefined;
|
2387 | onAbortCapture?: ReactEventHandler<T> | undefined;
|
2388 | onCanPlay?: ReactEventHandler<T> | undefined;
|
2389 | onCanPlayCapture?: ReactEventHandler<T> | undefined;
|
2390 | onCanPlayThrough?: ReactEventHandler<T> | undefined;
|
2391 | onCanPlayThroughCapture?: ReactEventHandler<T> | undefined;
|
2392 | onDurationChange?: ReactEventHandler<T> | undefined;
|
2393 | onDurationChangeCapture?: ReactEventHandler<T> | undefined;
|
2394 | onEmptied?: ReactEventHandler<T> | undefined;
|
2395 | onEmptiedCapture?: ReactEventHandler<T> | undefined;
|
2396 | onEncrypted?: ReactEventHandler<T> | undefined;
|
2397 | onEncryptedCapture?: ReactEventHandler<T> | undefined;
|
2398 | onEnded?: ReactEventHandler<T> | undefined;
|
2399 | onEndedCapture?: ReactEventHandler<T> | undefined;
|
2400 | onLoadedData?: ReactEventHandler<T> | undefined;
|
2401 | onLoadedDataCapture?: ReactEventHandler<T> | undefined;
|
2402 | onLoadedMetadata?: ReactEventHandler<T> | undefined;
|
2403 | onLoadedMetadataCapture?: ReactEventHandler<T> | undefined;
|
2404 | onLoadStart?: ReactEventHandler<T> | undefined;
|
2405 | onLoadStartCapture?: ReactEventHandler<T> | undefined;
|
2406 | onPause?: ReactEventHandler<T> | undefined;
|
2407 | onPauseCapture?: ReactEventHandler<T> | undefined;
|
2408 | onPlay?: ReactEventHandler<T> | undefined;
|
2409 | onPlayCapture?: ReactEventHandler<T> | undefined;
|
2410 | onPlaying?: ReactEventHandler<T> | undefined;
|
2411 | onPlayingCapture?: ReactEventHandler<T> | undefined;
|
2412 | onProgress?: ReactEventHandler<T> | undefined;
|
2413 | onProgressCapture?: ReactEventHandler<T> | undefined;
|
2414 | onRateChange?: ReactEventHandler<T> | undefined;
|
2415 | onRateChangeCapture?: ReactEventHandler<T> | undefined;
|
2416 | onResize?: ReactEventHandler<T> | undefined;
|
2417 | onResizeCapture?: ReactEventHandler<T> | undefined;
|
2418 | onSeeked?: ReactEventHandler<T> | undefined;
|
2419 | onSeekedCapture?: ReactEventHandler<T> | undefined;
|
2420 | onSeeking?: ReactEventHandler<T> | undefined;
|
2421 | onSeekingCapture?: ReactEventHandler<T> | undefined;
|
2422 | onStalled?: ReactEventHandler<T> | undefined;
|
2423 | onStalledCapture?: ReactEventHandler<T> | undefined;
|
2424 | onSuspend?: ReactEventHandler<T> | undefined;
|
2425 | onSuspendCapture?: ReactEventHandler<T> | undefined;
|
2426 | onTimeUpdate?: ReactEventHandler<T> | undefined;
|
2427 | onTimeUpdateCapture?: ReactEventHandler<T> | undefined;
|
2428 | onVolumeChange?: ReactEventHandler<T> | undefined;
|
2429 | onVolumeChangeCapture?: ReactEventHandler<T> | undefined;
|
2430 | onWaiting?: ReactEventHandler<T> | undefined;
|
2431 | onWaitingCapture?: ReactEventHandler<T> | undefined;
|
2432 |
|
2433 | // MouseEvents
|
2434 | onAuxClick?: MouseEventHandler<T> | undefined;
|
2435 | onAuxClickCapture?: MouseEventHandler<T> | undefined;
|
2436 | onClick?: MouseEventHandler<T> | undefined;
|
2437 | onClickCapture?: MouseEventHandler<T> | undefined;
|
2438 | onContextMenu?: MouseEventHandler<T> | undefined;
|
2439 | onContextMenuCapture?: MouseEventHandler<T> | undefined;
|
2440 | onDoubleClick?: MouseEventHandler<T> | undefined;
|
2441 | onDoubleClickCapture?: MouseEventHandler<T> | undefined;
|
2442 | onDrag?: DragEventHandler<T> | undefined;
|
2443 | onDragCapture?: DragEventHandler<T> | undefined;
|
2444 | onDragEnd?: DragEventHandler<T> | undefined;
|
2445 | onDragEndCapture?: DragEventHandler<T> | undefined;
|
2446 | onDragEnter?: DragEventHandler<T> | undefined;
|
2447 | onDragEnterCapture?: DragEventHandler<T> | undefined;
|
2448 | onDragExit?: DragEventHandler<T> | undefined;
|
2449 | onDragExitCapture?: DragEventHandler<T> | undefined;
|
2450 | onDragLeave?: DragEventHandler<T> | undefined;
|
2451 | onDragLeaveCapture?: DragEventHandler<T> | undefined;
|
2452 | onDragOver?: DragEventHandler<T> | undefined;
|
2453 | onDragOverCapture?: DragEventHandler<T> | undefined;
|
2454 | onDragStart?: DragEventHandler<T> | undefined;
|
2455 | onDragStartCapture?: DragEventHandler<T> | undefined;
|
2456 | onDrop?: DragEventHandler<T> | undefined;
|
2457 | onDropCapture?: DragEventHandler<T> | undefined;
|
2458 | onMouseDown?: MouseEventHandler<T> | undefined;
|
2459 | onMouseDownCapture?: MouseEventHandler<T> | undefined;
|
2460 | onMouseEnter?: MouseEventHandler<T> | undefined;
|
2461 | onMouseLeave?: MouseEventHandler<T> | undefined;
|
2462 | onMouseMove?: MouseEventHandler<T> | undefined;
|
2463 | onMouseMoveCapture?: MouseEventHandler<T> | undefined;
|
2464 | onMouseOut?: MouseEventHandler<T> | undefined;
|
2465 | onMouseOutCapture?: MouseEventHandler<T> | undefined;
|
2466 | onMouseOver?: MouseEventHandler<T> | undefined;
|
2467 | onMouseOverCapture?: MouseEventHandler<T> | undefined;
|
2468 | onMouseUp?: MouseEventHandler<T> | undefined;
|
2469 | onMouseUpCapture?: MouseEventHandler<T> | undefined;
|
2470 |
|
2471 | // Selection Events
|
2472 | onSelect?: ReactEventHandler<T> | undefined;
|
2473 | onSelectCapture?: ReactEventHandler<T> | undefined;
|
2474 |
|
2475 | // Touch Events
|
2476 | onTouchCancel?: TouchEventHandler<T> | undefined;
|
2477 | onTouchCancelCapture?: TouchEventHandler<T> | undefined;
|
2478 | onTouchEnd?: TouchEventHandler<T> | undefined;
|
2479 | onTouchEndCapture?: TouchEventHandler<T> | undefined;
|
2480 | onTouchMove?: TouchEventHandler<T> | undefined;
|
2481 | onTouchMoveCapture?: TouchEventHandler<T> | undefined;
|
2482 | onTouchStart?: TouchEventHandler<T> | undefined;
|
2483 | onTouchStartCapture?: TouchEventHandler<T> | undefined;
|
2484 |
|
2485 | // Pointer Events
|
2486 | onPointerDown?: PointerEventHandler<T> | undefined;
|
2487 | onPointerDownCapture?: PointerEventHandler<T> | undefined;
|
2488 | onPointerMove?: PointerEventHandler<T> | undefined;
|
2489 | onPointerMoveCapture?: PointerEventHandler<T> | undefined;
|
2490 | onPointerUp?: PointerEventHandler<T> | undefined;
|
2491 | onPointerUpCapture?: PointerEventHandler<T> | undefined;
|
2492 | onPointerCancel?: PointerEventHandler<T> | undefined;
|
2493 | onPointerCancelCapture?: PointerEventHandler<T> | undefined;
|
2494 | onPointerEnter?: PointerEventHandler<T> | undefined;
|
2495 | onPointerLeave?: PointerEventHandler<T> | undefined;
|
2496 | onPointerOver?: PointerEventHandler<T> | undefined;
|
2497 | onPointerOverCapture?: PointerEventHandler<T> | undefined;
|
2498 | onPointerOut?: PointerEventHandler<T> | undefined;
|
2499 | onPointerOutCapture?: PointerEventHandler<T> | undefined;
|
2500 | onGotPointerCapture?: PointerEventHandler<T> | undefined;
|
2501 | onGotPointerCaptureCapture?: PointerEventHandler<T> | undefined;
|
2502 | onLostPointerCapture?: PointerEventHandler<T> | undefined;
|
2503 | onLostPointerCaptureCapture?: PointerEventHandler<T> | undefined;
|
2504 |
|
2505 | // UI Events
|
2506 | onScroll?: UIEventHandler<T> | undefined;
|
2507 | onScrollCapture?: UIEventHandler<T> | undefined;
|
2508 |
|
2509 | // Wheel Events
|
2510 | onWheel?: WheelEventHandler<T> | undefined;
|
2511 | onWheelCapture?: WheelEventHandler<T> | undefined;
|
2512 |
|
2513 | // Animation Events
|
2514 | onAnimationStart?: AnimationEventHandler<T> | undefined;
|
2515 | onAnimationStartCapture?: AnimationEventHandler<T> | undefined;
|
2516 | onAnimationEnd?: AnimationEventHandler<T> | undefined;
|
2517 | onAnimationEndCapture?: AnimationEventHandler<T> | undefined;
|
2518 | onAnimationIteration?: AnimationEventHandler<T> | undefined;
|
2519 | onAnimationIterationCapture?: AnimationEventHandler<T> | undefined;
|
2520 |
|
2521 | // Transition Events
|
2522 | onTransitionEnd?: TransitionEventHandler<T> | undefined;
|
2523 | onTransitionEndCapture?: TransitionEventHandler<T> | undefined;
|
2524 | }
|
2525 |
|
2526 | export interface CSSProperties extends CSS.Properties<string | number> {
|
2527 | /**
|
2528 | * The index signature was removed to enable closed typing for style
|
2529 | * using CSSType. You're able to use type assertion or module augmentation
|
2530 | * to add properties or an index signature of your own.
|
2531 | *
|
2532 | * For examples and more information, visit:
|
2533 | * https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors
|
2534 | */
|
2535 | }
|
2536 |
|
2537 | // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/
|
2538 | interface AriaAttributes {
|
2539 | /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */
|
2540 | "aria-activedescendant"?: string | undefined;
|
2541 | /** 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. */
|
2542 | "aria-atomic"?: Booleanish | undefined;
|
2543 | /**
|
2544 | * 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
|
2545 | * presented if they are made.
|
2546 | */
|
2547 | "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
2548 | /** 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. */
|
2549 | /**
|
2550 | * Defines a string value that labels the current element, which is intended to be converted into Braille.
|
2551 | * @see aria-label.
|
2552 | */
|
2553 | "aria-braillelabel"?: string | undefined;
|
2554 | /**
|
2555 | * Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.
|
2556 | * @see aria-roledescription.
|
2557 | */
|
2558 | "aria-brailleroledescription"?: string | undefined;
|
2559 | "aria-busy"?: Booleanish | undefined;
|
2560 | /**
|
2561 | * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
|
2562 | * @see aria-pressed @see aria-selected.
|
2563 | */
|
2564 | "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
|
2565 | /**
|
2566 | * Defines the total number of columns in a table, grid, or treegrid.
|
2567 | * @see aria-colindex.
|
2568 | */
|
2569 | "aria-colcount"?: number | undefined;
|
2570 | /**
|
2571 | * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
|
2572 | * @see aria-colcount @see aria-colspan.
|
2573 | */
|
2574 | "aria-colindex"?: number | undefined;
|
2575 | /**
|
2576 | * Defines a human readable text alternative of aria-colindex.
|
2577 | * @see aria-rowindextext.
|
2578 | */
|
2579 | "aria-colindextext"?: string | undefined;
|
2580 | /**
|
2581 | * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
|
2582 | * @see aria-colindex @see aria-rowspan.
|
2583 | */
|
2584 | "aria-colspan"?: number | undefined;
|
2585 | /**
|
2586 | * Identifies the element (or elements) whose contents or presence are controlled by the current element.
|
2587 | * @see aria-owns.
|
2588 | */
|
2589 | "aria-controls"?: string | undefined;
|
2590 | /** Indicates the element that represents the current item within a container or set of related elements. */
|
2591 | "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
|
2592 | /**
|
2593 | * Identifies the element (or elements) that describes the object.
|
2594 | * @see aria-labelledby
|
2595 | */
|
2596 | "aria-describedby"?: string | undefined;
|
2597 | /**
|
2598 | * Defines a string value that describes or annotates the current element.
|
2599 | * @see related aria-describedby.
|
2600 | */
|
2601 | "aria-description"?: string | undefined;
|
2602 | /**
|
2603 | * Identifies the element that provides a detailed, extended description for the object.
|
2604 | * @see aria-describedby.
|
2605 | */
|
2606 | "aria-details"?: string | undefined;
|
2607 | /**
|
2608 | * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
|
2609 | * @see aria-hidden @see aria-readonly.
|
2610 | */
|
2611 | "aria-disabled"?: Booleanish | undefined;
|
2612 | /**
|
2613 | * Indicates what functions can be performed when a dragged object is released on the drop target.
|
2614 | * @deprecated in ARIA 1.1
|
2615 | */
|
2616 | "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
|
2617 | /**
|
2618 | * Identifies the element that provides an error message for the object.
|
2619 | * @see aria-invalid @see aria-describedby.
|
2620 | */
|
2621 | "aria-errormessage"?: string | undefined;
|
2622 | /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */
|
2623 | "aria-expanded"?: Booleanish | undefined;
|
2624 | /**
|
2625 | * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,
|
2626 | * allows assistive technology to override the general default of reading in document source order.
|
2627 | */
|
2628 | "aria-flowto"?: string | undefined;
|
2629 | /**
|
2630 | * Indicates an element's "grabbed" state in a drag-and-drop operation.
|
2631 | * @deprecated in ARIA 1.1
|
2632 | */
|
2633 | "aria-grabbed"?: Booleanish | undefined;
|
2634 | /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */
|
2635 | "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
2636 | /**
|
2637 | * Indicates whether the element is exposed to an accessibility API.
|
2638 | * @see aria-disabled.
|
2639 | */
|
2640 | "aria-hidden"?: Booleanish | undefined;
|
2641 | /**
|
2642 | * Indicates the entered value does not conform to the format expected by the application.
|
2643 | * @see aria-errormessage.
|
2644 | */
|
2645 | "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
2646 | /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */
|
2647 | "aria-keyshortcuts"?: string | undefined;
|
2648 | /**
|
2649 | * Defines a string value that labels the current element.
|
2650 | * @see aria-labelledby.
|
2651 | */
|
2652 | "aria-label"?: string | undefined;
|
2653 | /**
|
2654 | * Identifies the element (or elements) that labels the current element.
|
2655 | * @see aria-describedby.
|
2656 | */
|
2657 | "aria-labelledby"?: string | undefined;
|
2658 | /** Defines the hierarchical level of an element within a structure. */
|
2659 | "aria-level"?: number | undefined;
|
2660 | /** 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. */
|
2661 | "aria-live"?: "off" | "assertive" | "polite" | undefined;
|
2662 | /** Indicates whether an element is modal when displayed. */
|
2663 | "aria-modal"?: Booleanish | undefined;
|
2664 | /** Indicates whether a text box accepts multiple lines of input or only a single line. */
|
2665 | "aria-multiline"?: Booleanish | undefined;
|
2666 | /** Indicates that the user may select more than one item from the current selectable descendants. */
|
2667 | "aria-multiselectable"?: Booleanish | undefined;
|
2668 | /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */
|
2669 | "aria-orientation"?: "horizontal" | "vertical" | undefined;
|
2670 | /**
|
2671 | * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship
|
2672 | * between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
|
2673 | * @see aria-controls.
|
2674 | */
|
2675 | "aria-owns"?: string | undefined;
|
2676 | /**
|
2677 | * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.
|
2678 | * A hint could be a sample value or a brief description of the expected format.
|
2679 | */
|
2680 | "aria-placeholder"?: string | undefined;
|
2681 | /**
|
2682 | * 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.
|
2683 | * @see aria-setsize.
|
2684 | */
|
2685 | "aria-posinset"?: number | undefined;
|
2686 | /**
|
2687 | * Indicates the current "pressed" state of toggle buttons.
|
2688 | * @see aria-checked @see aria-selected.
|
2689 | */
|
2690 | "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
|
2691 | /**
|
2692 | * Indicates that the element is not editable, but is otherwise operable.
|
2693 | * @see aria-disabled.
|
2694 | */
|
2695 | "aria-readonly"?: Booleanish | undefined;
|
2696 | /**
|
2697 | * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
|
2698 | * @see aria-atomic.
|
2699 | */
|
2700 | "aria-relevant"?:
|
2701 | | "additions"
|
2702 | | "additions removals"
|
2703 | | "additions text"
|
2704 | | "all"
|
2705 | | "removals"
|
2706 | | "removals additions"
|
2707 | | "removals text"
|
2708 | | "text"
|
2709 | | "text additions"
|
2710 | | "text removals"
|
2711 | | undefined;
|
2712 | /** Indicates that user input is required on the element before a form may be submitted. */
|
2713 | "aria-required"?: Booleanish | undefined;
|
2714 | /** Defines a human-readable, author-localized description for the role of an element. */
|
2715 | "aria-roledescription"?: string | undefined;
|
2716 | /**
|
2717 | * Defines the total number of rows in a table, grid, or treegrid.
|
2718 | * @see aria-rowindex.
|
2719 | */
|
2720 | "aria-rowcount"?: number | undefined;
|
2721 | /**
|
2722 | * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
|
2723 | * @see aria-rowcount @see aria-rowspan.
|
2724 | */
|
2725 | "aria-rowindex"?: number | undefined;
|
2726 | /**
|
2727 | * Defines a human readable text alternative of aria-rowindex.
|
2728 | * @see aria-colindextext.
|
2729 | */
|
2730 | "aria-rowindextext"?: string | undefined;
|
2731 | /**
|
2732 | * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
|
2733 | * @see aria-rowindex @see aria-colspan.
|
2734 | */
|
2735 | "aria-rowspan"?: number | undefined;
|
2736 | /**
|
2737 | * Indicates the current "selected" state of various widgets.
|
2738 | * @see aria-checked @see aria-pressed.
|
2739 | */
|
2740 | "aria-selected"?: Booleanish | undefined;
|
2741 | /**
|
2742 | * 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.
|
2743 | * @see aria-posinset.
|
2744 | */
|
2745 | "aria-setsize"?: number | undefined;
|
2746 | /** Indicates if items in a table or grid are sorted in ascending or descending order. */
|
2747 | "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
2748 | /** Defines the maximum allowed value for a range widget. */
|
2749 | "aria-valuemax"?: number | undefined;
|
2750 | /** Defines the minimum allowed value for a range widget. */
|
2751 | "aria-valuemin"?: number | undefined;
|
2752 | /**
|
2753 | * Defines the current value for a range widget.
|
2754 | * @see aria-valuetext.
|
2755 | */
|
2756 | "aria-valuenow"?: number | undefined;
|
2757 | /** Defines the human readable text alternative of aria-valuenow for a range widget. */
|
2758 | "aria-valuetext"?: string | undefined;
|
2759 | }
|
2760 |
|
2761 | // All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions
|
2762 | type AriaRole =
|
2763 | | "alert"
|
2764 | | "alertdialog"
|
2765 | | "application"
|
2766 | | "article"
|
2767 | | "banner"
|
2768 | | "button"
|
2769 | | "cell"
|
2770 | | "checkbox"
|
2771 | | "columnheader"
|
2772 | | "combobox"
|
2773 | | "complementary"
|
2774 | | "contentinfo"
|
2775 | | "definition"
|
2776 | | "dialog"
|
2777 | | "directory"
|
2778 | | "document"
|
2779 | | "feed"
|
2780 | | "figure"
|
2781 | | "form"
|
2782 | | "grid"
|
2783 | | "gridcell"
|
2784 | | "group"
|
2785 | | "heading"
|
2786 | | "img"
|
2787 | | "link"
|
2788 | | "list"
|
2789 | | "listbox"
|
2790 | | "listitem"
|
2791 | | "log"
|
2792 | | "main"
|
2793 | | "marquee"
|
2794 | | "math"
|
2795 | | "menu"
|
2796 | | "menubar"
|
2797 | | "menuitem"
|
2798 | | "menuitemcheckbox"
|
2799 | | "menuitemradio"
|
2800 | | "navigation"
|
2801 | | "none"
|
2802 | | "note"
|
2803 | | "option"
|
2804 | | "presentation"
|
2805 | | "progressbar"
|
2806 | | "radio"
|
2807 | | "radiogroup"
|
2808 | | "region"
|
2809 | | "row"
|
2810 | | "rowgroup"
|
2811 | | "rowheader"
|
2812 | | "scrollbar"
|
2813 | | "search"
|
2814 | | "searchbox"
|
2815 | | "separator"
|
2816 | | "slider"
|
2817 | | "spinbutton"
|
2818 | | "status"
|
2819 | | "switch"
|
2820 | | "tab"
|
2821 | | "table"
|
2822 | | "tablist"
|
2823 | | "tabpanel"
|
2824 | | "term"
|
2825 | | "textbox"
|
2826 | | "timer"
|
2827 | | "toolbar"
|
2828 | | "tooltip"
|
2829 | | "tree"
|
2830 | | "treegrid"
|
2831 | | "treeitem"
|
2832 | | (string & {});
|
2833 |
|
2834 | interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
|
2835 | // React-specific Attributes
|
2836 | defaultChecked?: boolean | undefined;
|
2837 | defaultValue?: string | number | readonly string[] | undefined;
|
2838 | suppressContentEditableWarning?: boolean | undefined;
|
2839 | suppressHydrationWarning?: boolean | undefined;
|
2840 |
|
2841 | // Standard HTML Attributes
|
2842 | accessKey?: string | undefined;
|
2843 | autoFocus?: boolean | undefined;
|
2844 | className?: string | undefined;
|
2845 | contentEditable?: Booleanish | "inherit" | "plaintext-only" | undefined;
|
2846 | contextMenu?: string | undefined;
|
2847 | dir?: string | undefined;
|
2848 | draggable?: Booleanish | undefined;
|
2849 | hidden?: boolean | undefined;
|
2850 | id?: string | undefined;
|
2851 | lang?: string | undefined;
|
2852 | nonce?: string | undefined;
|
2853 | slot?: string | undefined;
|
2854 | spellCheck?: Booleanish | undefined;
|
2855 | style?: CSSProperties | undefined;
|
2856 | tabIndex?: number | undefined;
|
2857 | title?: string | undefined;
|
2858 | translate?: "yes" | "no" | undefined;
|
2859 |
|
2860 | // Unknown
|
2861 | radioGroup?: string | undefined; // <command>, <menuitem>
|
2862 |
|
2863 | // WAI-ARIA
|
2864 | role?: AriaRole | undefined;
|
2865 |
|
2866 | // RDFa Attributes
|
2867 | about?: string | undefined;
|
2868 | content?: string | undefined;
|
2869 | datatype?: string | undefined;
|
2870 | inlist?: any;
|
2871 | prefix?: string | undefined;
|
2872 | property?: string | undefined;
|
2873 | rel?: string | undefined;
|
2874 | resource?: string | undefined;
|
2875 | rev?: string | undefined;
|
2876 | typeof?: string | undefined;
|
2877 | vocab?: string | undefined;
|
2878 |
|
2879 | // Non-standard Attributes
|
2880 | autoCapitalize?: string | undefined;
|
2881 | autoCorrect?: string | undefined;
|
2882 | autoSave?: string | undefined;
|
2883 | color?: string | undefined;
|
2884 | itemProp?: string | undefined;
|
2885 | itemScope?: boolean | undefined;
|
2886 | itemType?: string | undefined;
|
2887 | itemID?: string | undefined;
|
2888 | itemRef?: string | undefined;
|
2889 | results?: number | undefined;
|
2890 | security?: string | undefined;
|
2891 | unselectable?: "on" | "off" | undefined;
|
2892 |
|
2893 | // Living Standard
|
2894 | /**
|
2895 | * Hints at the type of data that might be entered by the user while editing the element or its contents
|
2896 | * @see {@link https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute}
|
2897 | */
|
2898 | inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
2899 | /**
|
2900 | * Specify that a standard HTML element should behave like a defined custom built-in element
|
2901 | * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is}
|
2902 | */
|
2903 | is?: string | undefined;
|
2904 | }
|
2905 |
|
2906 | /**
|
2907 | * For internal usage only.
|
2908 | * Different release channels declare additional types of ReactNode this particular release channel accepts.
|
2909 | * App or library types should never augment this interface.
|
2910 | */
|
2911 | interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {}
|
2912 |
|
2913 | interface AllHTMLAttributes<T> extends HTMLAttributes<T> {
|
2914 | // Standard HTML Attributes
|
2915 | accept?: string | undefined;
|
2916 | acceptCharset?: string | undefined;
|
2917 | action?:
|
2918 | | string
|
2919 | | undefined
|
2920 | | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2921 | keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2922 | ];
|
2923 | allowFullScreen?: boolean | undefined;
|
2924 | allowTransparency?: boolean | undefined;
|
2925 | alt?: string | undefined;
|
2926 | as?: string | undefined;
|
2927 | async?: boolean | undefined;
|
2928 | autoComplete?: string | undefined;
|
2929 | autoPlay?: boolean | undefined;
|
2930 | capture?: boolean | "user" | "environment" | undefined;
|
2931 | cellPadding?: number | string | undefined;
|
2932 | cellSpacing?: number | string | undefined;
|
2933 | charSet?: string | undefined;
|
2934 | challenge?: string | undefined;
|
2935 | checked?: boolean | undefined;
|
2936 | cite?: string | undefined;
|
2937 | classID?: string | undefined;
|
2938 | cols?: number | undefined;
|
2939 | colSpan?: number | undefined;
|
2940 | controls?: boolean | undefined;
|
2941 | coords?: string | undefined;
|
2942 | crossOrigin?: CrossOrigin;
|
2943 | data?: string | undefined;
|
2944 | dateTime?: string | undefined;
|
2945 | default?: boolean | undefined;
|
2946 | defer?: boolean | undefined;
|
2947 | disabled?: boolean | undefined;
|
2948 | download?: any;
|
2949 | encType?: string | undefined;
|
2950 | form?: string | undefined;
|
2951 | formAction?:
|
2952 | | string
|
2953 | | undefined
|
2954 | | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
2955 | keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
2956 | ];
|
2957 | formEncType?: string | undefined;
|
2958 | formMethod?: string | undefined;
|
2959 | formNoValidate?: boolean | undefined;
|
2960 | formTarget?: string | undefined;
|
2961 | frameBorder?: number | string | undefined;
|
2962 | headers?: string | undefined;
|
2963 | height?: number | string | undefined;
|
2964 | high?: number | undefined;
|
2965 | href?: string | undefined;
|
2966 | hrefLang?: string | undefined;
|
2967 | htmlFor?: string | undefined;
|
2968 | httpEquiv?: string | undefined;
|
2969 | integrity?: string | undefined;
|
2970 | keyParams?: string | undefined;
|
2971 | keyType?: string | undefined;
|
2972 | kind?: string | undefined;
|
2973 | label?: string | undefined;
|
2974 | list?: string | undefined;
|
2975 | loop?: boolean | undefined;
|
2976 | low?: number | undefined;
|
2977 | manifest?: string | undefined;
|
2978 | marginHeight?: number | undefined;
|
2979 | marginWidth?: number | undefined;
|
2980 | max?: number | string | undefined;
|
2981 | maxLength?: number | undefined;
|
2982 | media?: string | undefined;
|
2983 | mediaGroup?: string | undefined;
|
2984 | method?: string | undefined;
|
2985 | min?: number | string | undefined;
|
2986 | minLength?: number | undefined;
|
2987 | multiple?: boolean | undefined;
|
2988 | muted?: boolean | undefined;
|
2989 | name?: string | undefined;
|
2990 | noValidate?: boolean | undefined;
|
2991 | open?: boolean | undefined;
|
2992 | optimum?: number | undefined;
|
2993 | pattern?: string | undefined;
|
2994 | placeholder?: string | undefined;
|
2995 | playsInline?: boolean | undefined;
|
2996 | poster?: string | undefined;
|
2997 | preload?: string | undefined;
|
2998 | readOnly?: boolean | undefined;
|
2999 | required?: boolean | undefined;
|
3000 | reversed?: boolean | undefined;
|
3001 | rows?: number | undefined;
|
3002 | rowSpan?: number | undefined;
|
3003 | sandbox?: string | undefined;
|
3004 | scope?: string | undefined;
|
3005 | scoped?: boolean | undefined;
|
3006 | scrolling?: string | undefined;
|
3007 | seamless?: boolean | undefined;
|
3008 | selected?: boolean | undefined;
|
3009 | shape?: string | undefined;
|
3010 | size?: number | undefined;
|
3011 | sizes?: string | undefined;
|
3012 | span?: number | undefined;
|
3013 | src?: string | undefined;
|
3014 | srcDoc?: string | undefined;
|
3015 | srcLang?: string | undefined;
|
3016 | srcSet?: string | undefined;
|
3017 | start?: number | undefined;
|
3018 | step?: number | string | undefined;
|
3019 | summary?: string | undefined;
|
3020 | target?: string | undefined;
|
3021 | type?: string | undefined;
|
3022 | useMap?: string | undefined;
|
3023 | value?: string | readonly string[] | number | undefined;
|
3024 | width?: number | string | undefined;
|
3025 | wmode?: string | undefined;
|
3026 | wrap?: string | undefined;
|
3027 | }
|
3028 |
|
3029 | type HTMLAttributeReferrerPolicy =
|
3030 | | ""
|
3031 | | "no-referrer"
|
3032 | | "no-referrer-when-downgrade"
|
3033 | | "origin"
|
3034 | | "origin-when-cross-origin"
|
3035 | | "same-origin"
|
3036 | | "strict-origin"
|
3037 | | "strict-origin-when-cross-origin"
|
3038 | | "unsafe-url";
|
3039 |
|
3040 | type HTMLAttributeAnchorTarget =
|
3041 | | "_self"
|
3042 | | "_blank"
|
3043 | | "_parent"
|
3044 | | "_top"
|
3045 | | (string & {});
|
3046 |
|
3047 | interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
|
3048 | download?: any;
|
3049 | href?: string | undefined;
|
3050 | hrefLang?: string | undefined;
|
3051 | media?: string | undefined;
|
3052 | ping?: string | undefined;
|
3053 | target?: HTMLAttributeAnchorTarget | undefined;
|
3054 | type?: string | undefined;
|
3055 | referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
3056 | }
|
3057 |
|
3058 | interface AudioHTMLAttributes<T> extends MediaHTMLAttributes<T> {}
|
3059 |
|
3060 | interface AreaHTMLAttributes<T> extends HTMLAttributes<T> {
|
3061 | alt?: string | undefined;
|
3062 | coords?: string | undefined;
|
3063 | download?: any;
|
3064 | href?: string | undefined;
|
3065 | hrefLang?: string | undefined;
|
3066 | media?: string | undefined;
|
3067 | referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
3068 | shape?: string | undefined;
|
3069 | target?: string | undefined;
|
3070 | }
|
3071 |
|
3072 | interface BaseHTMLAttributes<T> extends HTMLAttributes<T> {
|
3073 | href?: string | undefined;
|
3074 | target?: string | undefined;
|
3075 | }
|
3076 |
|
3077 | interface BlockquoteHTMLAttributes<T> extends HTMLAttributes<T> {
|
3078 | cite?: string | undefined;
|
3079 | }
|
3080 |
|
3081 | interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
|
3082 | disabled?: boolean | undefined;
|
3083 | form?: string | undefined;
|
3084 | formAction?:
|
3085 | | string
|
3086 | | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
3087 | keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
3088 | ]
|
3089 | | undefined;
|
3090 | formEncType?: string | undefined;
|
3091 | formMethod?: string | undefined;
|
3092 | formNoValidate?: boolean | undefined;
|
3093 | formTarget?: string | undefined;
|
3094 | name?: string | undefined;
|
3095 | type?: "submit" | "reset" | "button" | undefined;
|
3096 | value?: string | readonly string[] | number | undefined;
|
3097 | }
|
3098 |
|
3099 | interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> {
|
3100 | height?: number | string | undefined;
|
3101 | width?: number | string | undefined;
|
3102 | }
|
3103 |
|
3104 | interface ColHTMLAttributes<T> extends HTMLAttributes<T> {
|
3105 | span?: number | undefined;
|
3106 | width?: number | string | undefined;
|
3107 | }
|
3108 |
|
3109 | interface ColgroupHTMLAttributes<T> extends HTMLAttributes<T> {
|
3110 | span?: number | undefined;
|
3111 | }
|
3112 |
|
3113 | interface DataHTMLAttributes<T> extends HTMLAttributes<T> {
|
3114 | value?: string | readonly string[] | number | undefined;
|
3115 | }
|
3116 |
|
3117 | interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> {
|
3118 | open?: boolean | undefined;
|
3119 | onToggle?: ReactEventHandler<T> | undefined;
|
3120 | name?: string | undefined;
|
3121 | }
|
3122 |
|
3123 | interface DelHTMLAttributes<T> extends HTMLAttributes<T> {
|
3124 | cite?: string | undefined;
|
3125 | dateTime?: string | undefined;
|
3126 | }
|
3127 |
|
3128 | interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
|
3129 | onCancel?: ReactEventHandler<T> | undefined;
|
3130 | onClose?: ReactEventHandler<T> | undefined;
|
3131 | open?: boolean | undefined;
|
3132 | }
|
3133 |
|
3134 | interface EmbedHTMLAttributes<T> extends HTMLAttributes<T> {
|
3135 | height?: number | string | undefined;
|
3136 | src?: string | undefined;
|
3137 | type?: string | undefined;
|
3138 | width?: number | string | undefined;
|
3139 | }
|
3140 |
|
3141 | interface FieldsetHTMLAttributes<T> extends HTMLAttributes<T> {
|
3142 | disabled?: boolean | undefined;
|
3143 | form?: string | undefined;
|
3144 | name?: string | undefined;
|
3145 | }
|
3146 |
|
3147 | interface FormHTMLAttributes<T> extends HTMLAttributes<T> {
|
3148 | acceptCharset?: string | undefined;
|
3149 | action?:
|
3150 | | string
|
3151 | | undefined
|
3152 | | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
3153 | keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
3154 | ];
|
3155 | autoComplete?: string | undefined;
|
3156 | encType?: string | undefined;
|
3157 | method?: string | undefined;
|
3158 | name?: string | undefined;
|
3159 | noValidate?: boolean | undefined;
|
3160 | target?: string | undefined;
|
3161 | }
|
3162 |
|
3163 | interface HtmlHTMLAttributes<T> extends HTMLAttributes<T> {
|
3164 | manifest?: string | undefined;
|
3165 | }
|
3166 |
|
3167 | interface IframeHTMLAttributes<T> extends HTMLAttributes<T> {
|
3168 | allow?: string | undefined;
|
3169 | allowFullScreen?: boolean | undefined;
|
3170 | allowTransparency?: boolean | undefined;
|
3171 | /** @deprecated */
|
3172 | frameBorder?: number | string | undefined;
|
3173 | height?: number | string | undefined;
|
3174 | loading?: "eager" | "lazy" | undefined;
|
3175 | /** @deprecated */
|
3176 | marginHeight?: number | undefined;
|
3177 | /** @deprecated */
|
3178 | marginWidth?: number | undefined;
|
3179 | name?: string | undefined;
|
3180 | referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
3181 | sandbox?: string | undefined;
|
3182 | /** @deprecated */
|
3183 | scrolling?: string | undefined;
|
3184 | seamless?: boolean | undefined;
|
3185 | src?: string | undefined;
|
3186 | srcDoc?: string | undefined;
|
3187 | width?: number | string | undefined;
|
3188 | }
|
3189 |
|
3190 | interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
|
3191 | alt?: string | undefined;
|
3192 | crossOrigin?: CrossOrigin;
|
3193 | decoding?: "async" | "auto" | "sync" | undefined;
|
3194 | fetchPriority?: "high" | "low" | "auto";
|
3195 | height?: number | string | undefined;
|
3196 | loading?: "eager" | "lazy" | undefined;
|
3197 | referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
3198 | sizes?: string | undefined;
|
3199 | src?: string | undefined;
|
3200 | srcSet?: string | undefined;
|
3201 | useMap?: string | undefined;
|
3202 | width?: number | string | undefined;
|
3203 | }
|
3204 |
|
3205 | interface InsHTMLAttributes<T> extends HTMLAttributes<T> {
|
3206 | cite?: string | undefined;
|
3207 | dateTime?: string | undefined;
|
3208 | }
|
3209 |
|
3210 | type HTMLInputTypeAttribute =
|
3211 | | "button"
|
3212 | | "checkbox"
|
3213 | | "color"
|
3214 | | "date"
|
3215 | | "datetime-local"
|
3216 | | "email"
|
3217 | | "file"
|
3218 | | "hidden"
|
3219 | | "image"
|
3220 | | "month"
|
3221 | | "number"
|
3222 | | "password"
|
3223 | | "radio"
|
3224 | | "range"
|
3225 | | "reset"
|
3226 | | "search"
|
3227 | | "submit"
|
3228 | | "tel"
|
3229 | | "text"
|
3230 | | "time"
|
3231 | | "url"
|
3232 | | "week"
|
3233 | | (string & {});
|
3234 |
|
3235 | type AutoFillAddressKind = "billing" | "shipping";
|
3236 | type AutoFillBase = "" | "off" | "on";
|
3237 | type AutoFillContactField =
|
3238 | | "email"
|
3239 | | "tel"
|
3240 | | "tel-area-code"
|
3241 | | "tel-country-code"
|
3242 | | "tel-extension"
|
3243 | | "tel-local"
|
3244 | | "tel-local-prefix"
|
3245 | | "tel-local-suffix"
|
3246 | | "tel-national";
|
3247 | type AutoFillContactKind = "home" | "mobile" | "work";
|
3248 | type AutoFillCredentialField = "webauthn";
|
3249 | type AutoFillNormalField =
|
3250 | | "additional-name"
|
3251 | | "address-level1"
|
3252 | | "address-level2"
|
3253 | | "address-level3"
|
3254 | | "address-level4"
|
3255 | | "address-line1"
|
3256 | | "address-line2"
|
3257 | | "address-line3"
|
3258 | | "bday-day"
|
3259 | | "bday-month"
|
3260 | | "bday-year"
|
3261 | | "cc-csc"
|
3262 | | "cc-exp"
|
3263 | | "cc-exp-month"
|
3264 | | "cc-exp-year"
|
3265 | | "cc-family-name"
|
3266 | | "cc-given-name"
|
3267 | | "cc-name"
|
3268 | | "cc-number"
|
3269 | | "cc-type"
|
3270 | | "country"
|
3271 | | "country-name"
|
3272 | | "current-password"
|
3273 | | "family-name"
|
3274 | | "given-name"
|
3275 | | "honorific-prefix"
|
3276 | | "honorific-suffix"
|
3277 | | "name"
|
3278 | | "new-password"
|
3279 | | "one-time-code"
|
3280 | | "organization"
|
3281 | | "postal-code"
|
3282 | | "street-address"
|
3283 | | "transaction-amount"
|
3284 | | "transaction-currency"
|
3285 | | "username";
|
3286 | type OptionalPrefixToken<T extends string> = `${T} ` | "";
|
3287 | type OptionalPostfixToken<T extends string> = ` ${T}` | "";
|
3288 | type AutoFillField = AutoFillNormalField | `${OptionalPrefixToken<AutoFillContactKind>}${AutoFillContactField}`;
|
3289 | type AutoFillSection = `section-${string}`;
|
3290 | type AutoFill =
|
3291 | | AutoFillBase
|
3292 | | `${OptionalPrefixToken<AutoFillSection>}${OptionalPrefixToken<
|
3293 | AutoFillAddressKind
|
3294 | >}${AutoFillField}${OptionalPostfixToken<AutoFillCredentialField>}`;
|
3295 | type HTMLInputAutoCompleteAttribute = AutoFill | (string & {});
|
3296 |
|
3297 | interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
|
3298 | accept?: string | undefined;
|
3299 | alt?: string | undefined;
|
3300 | autoComplete?: HTMLInputAutoCompleteAttribute | undefined;
|
3301 | capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
|
3302 | checked?: boolean | undefined;
|
3303 | disabled?: boolean | undefined;
|
3304 | enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
3305 | form?: string | undefined;
|
3306 | formAction?:
|
3307 | | string
|
3308 | | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
|
3309 | keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
|
3310 | ]
|
3311 | | undefined;
|
3312 | formEncType?: string | undefined;
|
3313 | formMethod?: string | undefined;
|
3314 | formNoValidate?: boolean | undefined;
|
3315 | formTarget?: string | undefined;
|
3316 | height?: number | string | undefined;
|
3317 | list?: string | undefined;
|
3318 | max?: number | string | undefined;
|
3319 | maxLength?: number | undefined;
|
3320 | min?: number | string | undefined;
|
3321 | minLength?: number | undefined;
|
3322 | multiple?: boolean | undefined;
|
3323 | name?: string | undefined;
|
3324 | pattern?: string | undefined;
|
3325 | placeholder?: string | undefined;
|
3326 | readOnly?: boolean | undefined;
|
3327 | required?: boolean | undefined;
|
3328 | size?: number | undefined;
|
3329 | src?: string | undefined;
|
3330 | step?: number | string | undefined;
|
3331 | type?: HTMLInputTypeAttribute | undefined;
|
3332 | value?: string | readonly string[] | number | undefined;
|
3333 | width?: number | string | undefined;
|
3334 |
|
3335 | onChange?: ChangeEventHandler<T> | undefined;
|
3336 | }
|
3337 |
|
3338 | interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
|
3339 | challenge?: string | undefined;
|
3340 | disabled?: boolean | undefined;
|
3341 | form?: string | undefined;
|
3342 | keyType?: string | undefined;
|
3343 | keyParams?: string | undefined;
|
3344 | name?: string | undefined;
|
3345 | }
|
3346 |
|
3347 | interface LabelHTMLAttributes<T> extends HTMLAttributes<T> {
|
3348 | form?: string | undefined;
|
3349 | htmlFor?: string | undefined;
|
3350 | }
|
3351 |
|
3352 | interface LiHTMLAttributes<T> extends HTMLAttributes<T> {
|
3353 | value?: string | readonly string[] | number | undefined;
|
3354 | }
|
3355 |
|
3356 | interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
3357 | as?: string | undefined;
|
3358 | crossOrigin?: CrossOrigin;
|
3359 | fetchPriority?: "high" | "low" | "auto";
|
3360 | href?: string | undefined;
|
3361 | hrefLang?: string | undefined;
|
3362 | integrity?: string | undefined;
|
3363 | media?: string | undefined;
|
3364 | imageSrcSet?: string | undefined;
|
3365 | imageSizes?: string | undefined;
|
3366 | referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
3367 | sizes?: string | undefined;
|
3368 | type?: string | undefined;
|
3369 | charSet?: string | undefined;
|
3370 | }
|
3371 |
|
3372 | interface MapHTMLAttributes<T> extends HTMLAttributes<T> {
|
3373 | name?: string | undefined;
|
3374 | }
|
3375 |
|
3376 | interface MenuHTMLAttributes<T> extends HTMLAttributes<T> {
|
3377 | type?: string | undefined;
|
3378 | }
|
3379 |
|
3380 | interface MediaHTMLAttributes<T> extends HTMLAttributes<T> {
|
3381 | autoPlay?: boolean | undefined;
|
3382 | controls?: boolean | undefined;
|
3383 | controlsList?: string | undefined;
|
3384 | crossOrigin?: CrossOrigin;
|
3385 | loop?: boolean | undefined;
|
3386 | mediaGroup?: string | undefined;
|
3387 | muted?: boolean | undefined;
|
3388 | playsInline?: boolean | undefined;
|
3389 | preload?: string | undefined;
|
3390 | src?: string | undefined;
|
3391 | }
|
3392 |
|
3393 | interface MetaHTMLAttributes<T> extends HTMLAttributes<T> {
|
3394 | charSet?: string | undefined;
|
3395 | content?: string | undefined;
|
3396 | httpEquiv?: string | undefined;
|
3397 | media?: string | undefined;
|
3398 | name?: string | undefined;
|
3399 | }
|
3400 |
|
3401 | interface MeterHTMLAttributes<T> extends HTMLAttributes<T> {
|
3402 | form?: string | undefined;
|
3403 | high?: number | undefined;
|
3404 | low?: number | undefined;
|
3405 | max?: number | string | undefined;
|
3406 | min?: number | string | undefined;
|
3407 | optimum?: number | undefined;
|
3408 | value?: string | readonly string[] | number | undefined;
|
3409 | }
|
3410 |
|
3411 | interface QuoteHTMLAttributes<T> extends HTMLAttributes<T> {
|
3412 | cite?: string | undefined;
|
3413 | }
|
3414 |
|
3415 | interface ObjectHTMLAttributes<T> extends HTMLAttributes<T> {
|
3416 | classID?: string | undefined;
|
3417 | data?: string | undefined;
|
3418 | form?: string | undefined;
|
3419 | height?: number | string | undefined;
|
3420 | name?: string | undefined;
|
3421 | type?: string | undefined;
|
3422 | useMap?: string | undefined;
|
3423 | width?: number | string | undefined;
|
3424 | wmode?: string | undefined;
|
3425 | }
|
3426 |
|
3427 | interface OlHTMLAttributes<T> extends HTMLAttributes<T> {
|
3428 | reversed?: boolean | undefined;
|
3429 | start?: number | undefined;
|
3430 | type?: "1" | "a" | "A" | "i" | "I" | undefined;
|
3431 | }
|
3432 |
|
3433 | interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> {
|
3434 | disabled?: boolean | undefined;
|
3435 | label?: string | undefined;
|
3436 | }
|
3437 |
|
3438 | interface OptionHTMLAttributes<T> extends HTMLAttributes<T> {
|
3439 | disabled?: boolean | undefined;
|
3440 | label?: string | undefined;
|
3441 | selected?: boolean | undefined;
|
3442 | value?: string | readonly string[] | number | undefined;
|
3443 | }
|
3444 |
|
3445 | interface OutputHTMLAttributes<T> extends HTMLAttributes<T> {
|
3446 | form?: string | undefined;
|
3447 | htmlFor?: string | undefined;
|
3448 | name?: string | undefined;
|
3449 | }
|
3450 |
|
3451 | interface ParamHTMLAttributes<T> extends HTMLAttributes<T> {
|
3452 | name?: string | undefined;
|
3453 | value?: string | readonly string[] | number | undefined;
|
3454 | }
|
3455 |
|
3456 | interface ProgressHTMLAttributes<T> extends HTMLAttributes<T> {
|
3457 | max?: number | string | undefined;
|
3458 | value?: string | readonly string[] | number | undefined;
|
3459 | }
|
3460 |
|
3461 | interface SlotHTMLAttributes<T> extends HTMLAttributes<T> {
|
3462 | name?: string | undefined;
|
3463 | }
|
3464 |
|
3465 | interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
|
3466 | async?: boolean | undefined;
|
3467 | /** @deprecated */
|
3468 | charSet?: string | undefined;
|
3469 | crossOrigin?: CrossOrigin;
|
3470 | defer?: boolean | undefined;
|
3471 | integrity?: string | undefined;
|
3472 | noModule?: boolean | undefined;
|
3473 | referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
3474 | src?: string | undefined;
|
3475 | type?: string | undefined;
|
3476 | }
|
3477 |
|
3478 | interface SelectHTMLAttributes<T> extends HTMLAttributes<T> {
|
3479 | autoComplete?: string | undefined;
|
3480 | disabled?: boolean | undefined;
|
3481 | form?: string | undefined;
|
3482 | multiple?: boolean | undefined;
|
3483 | name?: string | undefined;
|
3484 | required?: boolean | undefined;
|
3485 | size?: number | undefined;
|
3486 | value?: string | readonly string[] | number | undefined;
|
3487 | onChange?: ChangeEventHandler<T> | undefined;
|
3488 | }
|
3489 |
|
3490 | interface SourceHTMLAttributes<T> extends HTMLAttributes<T> {
|
3491 | height?: number | string | undefined;
|
3492 | media?: string | undefined;
|
3493 | sizes?: string | undefined;
|
3494 | src?: string | undefined;
|
3495 | srcSet?: string | undefined;
|
3496 | type?: string | undefined;
|
3497 | width?: number | string | undefined;
|
3498 | }
|
3499 |
|
3500 | interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
|
3501 | media?: string | undefined;
|
3502 | scoped?: boolean | undefined;
|
3503 | type?: string | undefined;
|
3504 | }
|
3505 |
|
3506 | interface TableHTMLAttributes<T> extends HTMLAttributes<T> {
|
3507 | align?: "left" | "center" | "right" | undefined;
|
3508 | bgcolor?: string | undefined;
|
3509 | border?: number | undefined;
|
3510 | cellPadding?: number | string | undefined;
|
3511 | cellSpacing?: number | string | undefined;
|
3512 | frame?: boolean | undefined;
|
3513 | rules?: "none" | "groups" | "rows" | "columns" | "all" | undefined;
|
3514 | summary?: string | undefined;
|
3515 | width?: number | string | undefined;
|
3516 | }
|
3517 |
|
3518 | interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> {
|
3519 | autoComplete?: string | undefined;
|
3520 | cols?: number | undefined;
|
3521 | dirName?: string | undefined;
|
3522 | disabled?: boolean | undefined;
|
3523 | form?: string | undefined;
|
3524 | maxLength?: number | undefined;
|
3525 | minLength?: number | undefined;
|
3526 | name?: string | undefined;
|
3527 | placeholder?: string | undefined;
|
3528 | readOnly?: boolean | undefined;
|
3529 | required?: boolean | undefined;
|
3530 | rows?: number | undefined;
|
3531 | value?: string | readonly string[] | number | undefined;
|
3532 | wrap?: string | undefined;
|
3533 |
|
3534 | onChange?: ChangeEventHandler<T> | undefined;
|
3535 | }
|
3536 |
|
3537 | interface TdHTMLAttributes<T> extends HTMLAttributes<T> {
|
3538 | align?: "left" | "center" | "right" | "justify" | "char" | undefined;
|
3539 | colSpan?: number | undefined;
|
3540 | headers?: string | undefined;
|
3541 | rowSpan?: number | undefined;
|
3542 | scope?: string | undefined;
|
3543 | abbr?: string | undefined;
|
3544 | height?: number | string | undefined;
|
3545 | width?: number | string | undefined;
|
3546 | valign?: "top" | "middle" | "bottom" | "baseline" | undefined;
|
3547 | }
|
3548 |
|
3549 | interface ThHTMLAttributes<T> extends HTMLAttributes<T> {
|
3550 | align?: "left" | "center" | "right" | "justify" | "char" | undefined;
|
3551 | colSpan?: number | undefined;
|
3552 | headers?: string | undefined;
|
3553 | rowSpan?: number | undefined;
|
3554 | scope?: string | undefined;
|
3555 | abbr?: string | undefined;
|
3556 | }
|
3557 |
|
3558 | interface TimeHTMLAttributes<T> extends HTMLAttributes<T> {
|
3559 | dateTime?: string | undefined;
|
3560 | }
|
3561 |
|
3562 | interface TrackHTMLAttributes<T> extends HTMLAttributes<T> {
|
3563 | default?: boolean | undefined;
|
3564 | kind?: string | undefined;
|
3565 | label?: string | undefined;
|
3566 | src?: string | undefined;
|
3567 | srcLang?: string | undefined;
|
3568 | }
|
3569 |
|
3570 | interface VideoHTMLAttributes<T> extends MediaHTMLAttributes<T> {
|
3571 | height?: number | string | undefined;
|
3572 | playsInline?: boolean | undefined;
|
3573 | poster?: string | undefined;
|
3574 | width?: number | string | undefined;
|
3575 | disablePictureInPicture?: boolean | undefined;
|
3576 | disableRemotePlayback?: boolean | undefined;
|
3577 | }
|
3578 |
|
3579 | // this list is "complete" in that it contains every SVG attribute
|
3580 | // that React supports, but the types can be improved.
|
3581 | // Full list here: https://facebook.github.io/react/docs/dom-elements.html
|
3582 | //
|
3583 | // The three broad type categories are (in order of restrictiveness):
|
3584 | // - "number | string"
|
3585 | // - "string"
|
3586 | // - union of string literals
|
3587 | interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T> {
|
3588 | // React-specific Attributes
|
3589 | suppressHydrationWarning?: boolean | undefined;
|
3590 |
|
3591 | // Attributes which also defined in HTMLAttributes
|
3592 | // See comment in SVGDOMPropertyConfig.js
|
3593 | className?: string | undefined;
|
3594 | color?: string | undefined;
|
3595 | height?: number | string | undefined;
|
3596 | id?: string | undefined;
|
3597 | lang?: string | undefined;
|
3598 | max?: number | string | undefined;
|
3599 | media?: string | undefined;
|
3600 | method?: string | undefined;
|
3601 | min?: number | string | undefined;
|
3602 | name?: string | undefined;
|
3603 | style?: CSSProperties | undefined;
|
3604 | target?: string | undefined;
|
3605 | type?: string | undefined;
|
3606 | width?: number | string | undefined;
|
3607 |
|
3608 | // Other HTML properties supported by SVG elements in browsers
|
3609 | role?: AriaRole | undefined;
|
3610 | tabIndex?: number | undefined;
|
3611 | crossOrigin?: CrossOrigin;
|
3612 |
|
3613 | // SVG Specific attributes
|
3614 | accentHeight?: number | string | undefined;
|
3615 | accumulate?: "none" | "sum" | undefined;
|
3616 | additive?: "replace" | "sum" | undefined;
|
3617 | alignmentBaseline?:
|
3618 | | "auto"
|
3619 | | "baseline"
|
3620 | | "before-edge"
|
3621 | | "text-before-edge"
|
3622 | | "middle"
|
3623 | | "central"
|
3624 | | "after-edge"
|
3625 | | "text-after-edge"
|
3626 | | "ideographic"
|
3627 | | "alphabetic"
|
3628 | | "hanging"
|
3629 | | "mathematical"
|
3630 | | "inherit"
|
3631 | | undefined;
|
3632 | allowReorder?: "no" | "yes" | undefined;
|
3633 | alphabetic?: number | string | undefined;
|
3634 | amplitude?: number | string | undefined;
|
3635 | arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined;
|
3636 | ascent?: number | string | undefined;
|
3637 | attributeName?: string | undefined;
|
3638 | attributeType?: string | undefined;
|
3639 | autoReverse?: Booleanish | undefined;
|
3640 | azimuth?: number | string | undefined;
|
3641 | baseFrequency?: number | string | undefined;
|
3642 | baselineShift?: number | string | undefined;
|
3643 | baseProfile?: number | string | undefined;
|
3644 | bbox?: number | string | undefined;
|
3645 | begin?: number | string | undefined;
|
3646 | bias?: number | string | undefined;
|
3647 | by?: number | string | undefined;
|
3648 | calcMode?: number | string | undefined;
|
3649 | capHeight?: number | string | undefined;
|
3650 | clip?: number | string | undefined;
|
3651 | clipPath?: string | undefined;
|
3652 | clipPathUnits?: number | string | undefined;
|
3653 | clipRule?: number | string | undefined;
|
3654 | colorInterpolation?: number | string | undefined;
|
3655 | colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined;
|
3656 | colorProfile?: number | string | undefined;
|
3657 | colorRendering?: number | string | undefined;
|
3658 | contentScriptType?: number | string | undefined;
|
3659 | contentStyleType?: number | string | undefined;
|
3660 | cursor?: number | string | undefined;
|
3661 | cx?: number | string | undefined;
|
3662 | cy?: number | string | undefined;
|
3663 | d?: string | undefined;
|
3664 | decelerate?: number | string | undefined;
|
3665 | descent?: number | string | undefined;
|
3666 | diffuseConstant?: number | string | undefined;
|
3667 | direction?: number | string | undefined;
|
3668 | display?: number | string | undefined;
|
3669 | divisor?: number | string | undefined;
|
3670 | dominantBaseline?: number | string | undefined;
|
3671 | dur?: number | string | undefined;
|
3672 | dx?: number | string | undefined;
|
3673 | dy?: number | string | undefined;
|
3674 | edgeMode?: number | string | undefined;
|
3675 | elevation?: number | string | undefined;
|
3676 | enableBackground?: number | string | undefined;
|
3677 | end?: number | string | undefined;
|
3678 | exponent?: number | string | undefined;
|
3679 | externalResourcesRequired?: Booleanish | undefined;
|
3680 | fill?: string | undefined;
|
3681 | fillOpacity?: number | string | undefined;
|
3682 | fillRule?: "nonzero" | "evenodd" | "inherit" | undefined;
|
3683 | filter?: string | undefined;
|
3684 | filterRes?: number | string | undefined;
|
3685 | filterUnits?: number | string | undefined;
|
3686 | floodColor?: number | string | undefined;
|
3687 | floodOpacity?: number | string | undefined;
|
3688 | focusable?: Booleanish | "auto" | undefined;
|
3689 | fontFamily?: string | undefined;
|
3690 | fontSize?: number | string | undefined;
|
3691 | fontSizeAdjust?: number | string | undefined;
|
3692 | fontStretch?: number | string | undefined;
|
3693 | fontStyle?: number | string | undefined;
|
3694 | fontVariant?: number | string | undefined;
|
3695 | fontWeight?: number | string | undefined;
|
3696 | format?: number | string | undefined;
|
3697 | fr?: number | string | undefined;
|
3698 | from?: number | string | undefined;
|
3699 | fx?: number | string | undefined;
|
3700 | fy?: number | string | undefined;
|
3701 | g1?: number | string | undefined;
|
3702 | g2?: number | string | undefined;
|
3703 | glyphName?: number | string | undefined;
|
3704 | glyphOrientationHorizontal?: number | string | undefined;
|
3705 | glyphOrientationVertical?: number | string | undefined;
|
3706 | glyphRef?: number | string | undefined;
|
3707 | gradientTransform?: string | undefined;
|
3708 | gradientUnits?: string | undefined;
|
3709 | hanging?: number | string | undefined;
|
3710 | horizAdvX?: number | string | undefined;
|
3711 | horizOriginX?: number | string | undefined;
|
3712 | href?: string | undefined;
|
3713 | ideographic?: number | string | undefined;
|
3714 | imageRendering?: number | string | undefined;
|
3715 | in2?: number | string | undefined;
|
3716 | in?: string | undefined;
|
3717 | intercept?: number | string | undefined;
|
3718 | k1?: number | string | undefined;
|
3719 | k2?: number | string | undefined;
|
3720 | k3?: number | string | undefined;
|
3721 | k4?: number | string | undefined;
|
3722 | k?: number | string | undefined;
|
3723 | kernelMatrix?: number | string | undefined;
|
3724 | kernelUnitLength?: number | string | undefined;
|
3725 | kerning?: number | string | undefined;
|
3726 | keyPoints?: number | string | undefined;
|
3727 | keySplines?: number | string | undefined;
|
3728 | keyTimes?: number | string | undefined;
|
3729 | lengthAdjust?: number | string | undefined;
|
3730 | letterSpacing?: number | string | undefined;
|
3731 | lightingColor?: number | string | undefined;
|
3732 | limitingConeAngle?: number | string | undefined;
|
3733 | local?: number | string | undefined;
|
3734 | markerEnd?: string | undefined;
|
3735 | markerHeight?: number | string | undefined;
|
3736 | markerMid?: string | undefined;
|
3737 | markerStart?: string | undefined;
|
3738 | markerUnits?: number | string | undefined;
|
3739 | markerWidth?: number | string | undefined;
|
3740 | mask?: string | undefined;
|
3741 | maskContentUnits?: number | string | undefined;
|
3742 | maskUnits?: number | string | undefined;
|
3743 | mathematical?: number | string | undefined;
|
3744 | mode?: number | string | undefined;
|
3745 | numOctaves?: number | string | undefined;
|
3746 | offset?: number | string | undefined;
|
3747 | opacity?: number | string | undefined;
|
3748 | operator?: number | string | undefined;
|
3749 | order?: number | string | undefined;
|
3750 | orient?: number | string | undefined;
|
3751 | orientation?: number | string | undefined;
|
3752 | origin?: number | string | undefined;
|
3753 | overflow?: number | string | undefined;
|
3754 | overlinePosition?: number | string | undefined;
|
3755 | overlineThickness?: number | string | undefined;
|
3756 | paintOrder?: number | string | undefined;
|
3757 | panose1?: number | string | undefined;
|
3758 | path?: string | undefined;
|
3759 | pathLength?: number | string | undefined;
|
3760 | patternContentUnits?: string | undefined;
|
3761 | patternTransform?: number | string | undefined;
|
3762 | patternUnits?: string | undefined;
|
3763 | pointerEvents?: number | string | undefined;
|
3764 | points?: string | undefined;
|
3765 | pointsAtX?: number | string | undefined;
|
3766 | pointsAtY?: number | string | undefined;
|
3767 | pointsAtZ?: number | string | undefined;
|
3768 | preserveAlpha?: Booleanish | undefined;
|
3769 | preserveAspectRatio?: string | undefined;
|
3770 | primitiveUnits?: number | string | undefined;
|
3771 | r?: number | string | undefined;
|
3772 | radius?: number | string | undefined;
|
3773 | refX?: number | string | undefined;
|
3774 | refY?: number | string | undefined;
|
3775 | renderingIntent?: number | string | undefined;
|
3776 | repeatCount?: number | string | undefined;
|
3777 | repeatDur?: number | string | undefined;
|
3778 | requiredExtensions?: number | string | undefined;
|
3779 | requiredFeatures?: number | string | undefined;
|
3780 | restart?: number | string | undefined;
|
3781 | result?: string | undefined;
|
3782 | rotate?: number | string | undefined;
|
3783 | rx?: number | string | undefined;
|
3784 | ry?: number | string | undefined;
|
3785 | scale?: number | string | undefined;
|
3786 | seed?: number | string | undefined;
|
3787 | shapeRendering?: number | string | undefined;
|
3788 | slope?: number | string | undefined;
|
3789 | spacing?: number | string | undefined;
|
3790 | specularConstant?: number | string | undefined;
|
3791 | specularExponent?: number | string | undefined;
|
3792 | speed?: number | string | undefined;
|
3793 | spreadMethod?: string | undefined;
|
3794 | startOffset?: number | string | undefined;
|
3795 | stdDeviation?: number | string | undefined;
|
3796 | stemh?: number | string | undefined;
|
3797 | stemv?: number | string | undefined;
|
3798 | stitchTiles?: number | string | undefined;
|
3799 | stopColor?: string | undefined;
|
3800 | stopOpacity?: number | string | undefined;
|
3801 | strikethroughPosition?: number | string | undefined;
|
3802 | strikethroughThickness?: number | string | undefined;
|
3803 | string?: number | string | undefined;
|
3804 | stroke?: string | undefined;
|
3805 | strokeDasharray?: string | number | undefined;
|
3806 | strokeDashoffset?: string | number | undefined;
|
3807 | strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined;
|
3808 | strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined;
|
3809 | strokeMiterlimit?: number | string | undefined;
|
3810 | strokeOpacity?: number | string | undefined;
|
3811 | strokeWidth?: number | string | undefined;
|
3812 | surfaceScale?: number | string | undefined;
|
3813 | systemLanguage?: number | string | undefined;
|
3814 | tableValues?: number | string | undefined;
|
3815 | targetX?: number | string | undefined;
|
3816 | targetY?: number | string | undefined;
|
3817 | textAnchor?: string | undefined;
|
3818 | textDecoration?: number | string | undefined;
|
3819 | textLength?: number | string | undefined;
|
3820 | textRendering?: number | string | undefined;
|
3821 | to?: number | string | undefined;
|
3822 | transform?: string | undefined;
|
3823 | u1?: number | string | undefined;
|
3824 | u2?: number | string | undefined;
|
3825 | underlinePosition?: number | string | undefined;
|
3826 | underlineThickness?: number | string | undefined;
|
3827 | unicode?: number | string | undefined;
|
3828 | unicodeBidi?: number | string | undefined;
|
3829 | unicodeRange?: number | string | undefined;
|
3830 | unitsPerEm?: number | string | undefined;
|
3831 | vAlphabetic?: number | string | undefined;
|
3832 | values?: string | undefined;
|
3833 | vectorEffect?: number | string | undefined;
|
3834 | version?: string | undefined;
|
3835 | vertAdvY?: number | string | undefined;
|
3836 | vertOriginX?: number | string | undefined;
|
3837 | vertOriginY?: number | string | undefined;
|
3838 | vHanging?: number | string | undefined;
|
3839 | vIdeographic?: number | string | undefined;
|
3840 | viewBox?: string | undefined;
|
3841 | viewTarget?: number | string | undefined;
|
3842 | visibility?: number | string | undefined;
|
3843 | vMathematical?: number | string | undefined;
|
3844 | widths?: number | string | undefined;
|
3845 | wordSpacing?: number | string | undefined;
|
3846 | writingMode?: number | string | undefined;
|
3847 | x1?: number | string | undefined;
|
3848 | x2?: number | string | undefined;
|
3849 | x?: number | string | undefined;
|
3850 | xChannelSelector?: string | undefined;
|
3851 | xHeight?: number | string | undefined;
|
3852 | xlinkActuate?: string | undefined;
|
3853 | xlinkArcrole?: string | undefined;
|
3854 | xlinkHref?: string | undefined;
|
3855 | xlinkRole?: string | undefined;
|
3856 | xlinkShow?: string | undefined;
|
3857 | xlinkTitle?: string | undefined;
|
3858 | xlinkType?: string | undefined;
|
3859 | xmlBase?: string | undefined;
|
3860 | xmlLang?: string | undefined;
|
3861 | xmlns?: string | undefined;
|
3862 | xmlnsXlink?: string | undefined;
|
3863 | xmlSpace?: string | undefined;
|
3864 | y1?: number | string | undefined;
|
3865 | y2?: number | string | undefined;
|
3866 | y?: number | string | undefined;
|
3867 | yChannelSelector?: string | undefined;
|
3868 | z?: number | string | undefined;
|
3869 | zoomAndPan?: string | undefined;
|
3870 | }
|
3871 |
|
3872 | interface WebViewHTMLAttributes<T> extends HTMLAttributes<T> {
|
3873 | allowFullScreen?: boolean | undefined;
|
3874 | allowpopups?: boolean | undefined;
|
3875 | autosize?: boolean | undefined;
|
3876 | blinkfeatures?: string | undefined;
|
3877 | disableblinkfeatures?: string | undefined;
|
3878 | disableguestresize?: boolean | undefined;
|
3879 | disablewebsecurity?: boolean | undefined;
|
3880 | guestinstance?: string | undefined;
|
3881 | httpreferrer?: string | undefined;
|
3882 | nodeintegration?: boolean | undefined;
|
3883 | partition?: string | undefined;
|
3884 | plugins?: boolean | undefined;
|
3885 | preload?: string | undefined;
|
3886 | src?: string | undefined;
|
3887 | useragent?: string | undefined;
|
3888 | webpreferences?: string | undefined;
|
3889 | }
|
3890 |
|
3891 | //
|
3892 | // React.DOM
|
3893 | // ----------------------------------------------------------------------
|
3894 |
|
3895 | interface ReactHTML {
|
3896 | a: DetailedHTMLFactory<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
|
3897 | abbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3898 | address: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3899 | area: DetailedHTMLFactory<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
|
3900 | article: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3901 | aside: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3902 | audio: DetailedHTMLFactory<AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
|
3903 | b: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3904 | base: DetailedHTMLFactory<BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>;
|
3905 | bdi: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3906 | bdo: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3907 | big: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3908 | blockquote: DetailedHTMLFactory<BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
3909 | body: DetailedHTMLFactory<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
|
3910 | br: DetailedHTMLFactory<HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
|
3911 | button: DetailedHTMLFactory<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
3912 | canvas: DetailedHTMLFactory<CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>;
|
3913 | caption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3914 | center: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3915 | cite: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3916 | code: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3917 | col: DetailedHTMLFactory<ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
3918 | colgroup: DetailedHTMLFactory<ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
3919 | data: DetailedHTMLFactory<DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
|
3920 | datalist: DetailedHTMLFactory<HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
|
3921 | dd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3922 | del: DetailedHTMLFactory<DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
|
3923 | details: DetailedHTMLFactory<DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>;
|
3924 | dfn: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3925 | dialog: DetailedHTMLFactory<DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
|
3926 | div: DetailedHTMLFactory<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
3927 | dl: DetailedHTMLFactory<HTMLAttributes<HTMLDListElement>, HTMLDListElement>;
|
3928 | dt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3929 | em: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3930 | embed: DetailedHTMLFactory<EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>;
|
3931 | fieldset: DetailedHTMLFactory<FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>;
|
3932 | figcaption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3933 | figure: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3934 | footer: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3935 | form: DetailedHTMLFactory<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;
|
3936 | h1: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
3937 | h2: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
3938 | h3: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
3939 | h4: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
3940 | h5: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
3941 | h6: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
3942 | head: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLHeadElement>;
|
3943 | header: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3944 | hgroup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3945 | hr: DetailedHTMLFactory<HTMLAttributes<HTMLHRElement>, HTMLHRElement>;
|
3946 | html: DetailedHTMLFactory<HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>;
|
3947 | i: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3948 | iframe: DetailedHTMLFactory<IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>;
|
3949 | img: DetailedHTMLFactory<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
|
3950 | input: DetailedHTMLFactory<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
3951 | ins: DetailedHTMLFactory<InsHTMLAttributes<HTMLModElement>, HTMLModElement>;
|
3952 | kbd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3953 | keygen: DetailedHTMLFactory<KeygenHTMLAttributes<HTMLElement>, HTMLElement>;
|
3954 | label: DetailedHTMLFactory<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
|
3955 | legend: DetailedHTMLFactory<HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>;
|
3956 | li: DetailedHTMLFactory<LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
|
3957 | link: DetailedHTMLFactory<LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>;
|
3958 | main: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3959 | map: DetailedHTMLFactory<MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>;
|
3960 | mark: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3961 | menu: DetailedHTMLFactory<MenuHTMLAttributes<HTMLElement>, HTMLElement>;
|
3962 | menuitem: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3963 | meta: DetailedHTMLFactory<MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
|
3964 | meter: DetailedHTMLFactory<MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>;
|
3965 | nav: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3966 | noscript: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3967 | object: DetailedHTMLFactory<ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
|
3968 | ol: DetailedHTMLFactory<OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
|
3969 | optgroup: DetailedHTMLFactory<OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
|
3970 | option: DetailedHTMLFactory<OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
|
3971 | output: DetailedHTMLFactory<OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>;
|
3972 | p: DetailedHTMLFactory<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
|
3973 | param: DetailedHTMLFactory<ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
|
3974 | picture: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3975 | pre: DetailedHTMLFactory<HTMLAttributes<HTMLPreElement>, HTMLPreElement>;
|
3976 | progress: DetailedHTMLFactory<ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>;
|
3977 | q: DetailedHTMLFactory<QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
3978 | rp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3979 | rt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3980 | ruby: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3981 | s: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3982 | samp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3983 | search: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3984 | slot: DetailedHTMLFactory<SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>;
|
3985 | script: DetailedHTMLFactory<ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>;
|
3986 | section: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3987 | select: DetailedHTMLFactory<SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
|
3988 | small: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3989 | source: DetailedHTMLFactory<SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>;
|
3990 | span: DetailedHTMLFactory<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
|
3991 | strong: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3992 | style: DetailedHTMLFactory<StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;
|
3993 | sub: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3994 | summary: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3995 | sup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
3996 | table: DetailedHTMLFactory<TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>;
|
3997 | template: DetailedHTMLFactory<HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>;
|
3998 | tbody: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
3999 | td: DetailedHTMLFactory<TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>;
|
4000 | textarea: DetailedHTMLFactory<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
|
4001 | tfoot: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
4002 | th: DetailedHTMLFactory<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
|
4003 | thead: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
4004 | time: DetailedHTMLFactory<TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>;
|
4005 | title: DetailedHTMLFactory<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
|
4006 | tr: DetailedHTMLFactory<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
|
4007 | track: DetailedHTMLFactory<TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
|
4008 | u: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
4009 | ul: DetailedHTMLFactory<HTMLAttributes<HTMLUListElement>, HTMLUListElement>;
|
4010 | "var": DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
4011 | video: DetailedHTMLFactory<VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
|
4012 | wbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
|
4013 | webview: DetailedHTMLFactory<WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>;
|
4014 | }
|
4015 |
|
4016 | interface ReactSVG {
|
4017 | animate: SVGFactory;
|
4018 | circle: SVGFactory;
|
4019 | clipPath: SVGFactory;
|
4020 | defs: SVGFactory;
|
4021 | desc: SVGFactory;
|
4022 | ellipse: SVGFactory;
|
4023 | feBlend: SVGFactory;
|
4024 | feColorMatrix: SVGFactory;
|
4025 | feComponentTransfer: SVGFactory;
|
4026 | feComposite: SVGFactory;
|
4027 | feConvolveMatrix: SVGFactory;
|
4028 | feDiffuseLighting: SVGFactory;
|
4029 | feDisplacementMap: SVGFactory;
|
4030 | feDistantLight: SVGFactory;
|
4031 | feDropShadow: SVGFactory;
|
4032 | feFlood: SVGFactory;
|
4033 | feFuncA: SVGFactory;
|
4034 | feFuncB: SVGFactory;
|
4035 | feFuncG: SVGFactory;
|
4036 | feFuncR: SVGFactory;
|
4037 | feGaussianBlur: SVGFactory;
|
4038 | feImage: SVGFactory;
|
4039 | feMerge: SVGFactory;
|
4040 | feMergeNode: SVGFactory;
|
4041 | feMorphology: SVGFactory;
|
4042 | feOffset: SVGFactory;
|
4043 | fePointLight: SVGFactory;
|
4044 | feSpecularLighting: SVGFactory;
|
4045 | feSpotLight: SVGFactory;
|
4046 | feTile: SVGFactory;
|
4047 | feTurbulence: SVGFactory;
|
4048 | filter: SVGFactory;
|
4049 | foreignObject: SVGFactory;
|
4050 | g: SVGFactory;
|
4051 | image: SVGFactory;
|
4052 | line: SVGFactory;
|
4053 | linearGradient: SVGFactory;
|
4054 | marker: SVGFactory;
|
4055 | mask: SVGFactory;
|
4056 | metadata: SVGFactory;
|
4057 | path: SVGFactory;
|
4058 | pattern: SVGFactory;
|
4059 | polygon: SVGFactory;
|
4060 | polyline: SVGFactory;
|
4061 | radialGradient: SVGFactory;
|
4062 | rect: SVGFactory;
|
4063 | stop: SVGFactory;
|
4064 | svg: SVGFactory;
|
4065 | switch: SVGFactory;
|
4066 | symbol: SVGFactory;
|
4067 | text: SVGFactory;
|
4068 | textPath: SVGFactory;
|
4069 | tspan: SVGFactory;
|
4070 | use: SVGFactory;
|
4071 | view: SVGFactory;
|
4072 | }
|
4073 |
|
4074 | interface ReactDOM extends ReactHTML, ReactSVG {}
|
4075 |
|
4076 | //
|
4077 | // React.PropTypes
|
4078 | // ----------------------------------------------------------------------
|
4079 |
|
4080 | /**
|
4081 | * @deprecated Use `Validator` from the ´prop-types` instead.
|
4082 | */
|
4083 | type Validator<T> = PropTypes.Validator<T>;
|
4084 |
|
4085 | |
4086 |
|
4087 |
|
4088 | type Requireable<T> = PropTypes.Requireable<T>;
|
4089 |
|
4090 | |
4091 |
|
4092 |
|
4093 | type ValidationMap<T> = PropTypes.ValidationMap<T>;
|
4094 |
|
4095 | |
4096 |
|
4097 |
|
4098 | type WeakValidationMap<T> = {
|
4099 | [K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined>
|
4100 | : undefined extends T[K] ? Validator<T[K] | null | undefined>
|
4101 | : Validator<T[K]>;
|
4102 | };
|
4103 |
|
4104 | |
4105 |
|
4106 |
|
4107 | interface ReactPropTypes {
|
4108 | any: typeof PropTypes.any;
|
4109 | array: typeof PropTypes.array;
|
4110 | bool: typeof PropTypes.bool;
|
4111 | func: typeof PropTypes.func;
|
4112 | number: typeof PropTypes.number;
|
4113 | object: typeof PropTypes.object;
|
4114 | string: typeof PropTypes.string;
|
4115 | node: typeof PropTypes.node;
|
4116 | element: typeof PropTypes.element;
|
4117 | instanceOf: typeof PropTypes.instanceOf;
|
4118 | oneOf: typeof PropTypes.oneOf;
|
4119 | oneOfType: typeof PropTypes.oneOfType;
|
4120 | arrayOf: typeof PropTypes.arrayOf;
|
4121 | objectOf: typeof PropTypes.objectOf;
|
4122 | shape: typeof PropTypes.shape;
|
4123 | exact: typeof PropTypes.exact;
|
4124 | }
|
4125 |
|
4126 |
|
4127 |
|
4128 |
|
4129 |
|
4130 | |
4131 |
|
4132 |
|
4133 |
|
4134 | interface ReactChildren {
|
4135 | map<T, C>(
|
4136 | children: C | readonly C[],
|
4137 | fn: (child: C, index: number) => T,
|
4138 | ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
|
4139 | forEach<C>(children: C | readonly C[], fn: (child: C, index: number) => void): void;
|
4140 | count(children: any): number;
|
4141 | only<C>(children: C): C extends any[] ? never : C;
|
4142 | toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>;
|
4143 | }
|
4144 |
|
4145 | //
|
4146 | // Browser Interfaces
|
4147 | // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
|
4148 | // ----------------------------------------------------------------------
|
4149 |
|
4150 | interface AbstractView {
|
4151 | styleMedia: StyleMedia;
|
4152 | document: Document;
|
4153 | }
|
4154 |
|
4155 | interface Touch {
|
4156 | identifier: number;
|
4157 | target: EventTarget;
|
4158 | screenX: number;
|
4159 | screenY: number;
|
4160 | clientX: number;
|
4161 | clientY: number;
|
4162 | pageX: number;
|
4163 | pageY: number;
|
4164 | }
|
4165 |
|
4166 | interface TouchList {
|
4167 | [index: number]: Touch;
|
4168 | length: number;
|
4169 | item(index: number): Touch;
|
4170 | identifiedTouch(identifier: number): Touch;
|
4171 | }
|
4172 |
|
4173 | //
|
4174 | // Error Interfaces
|
4175 | // ----------------------------------------------------------------------
|
4176 | interface ErrorInfo {
|
4177 | /**
|
4178 | * Captures which component contained the exception, and its ancestors.
|
4179 | */
|
4180 | componentStack?: string | null;
|
4181 | digest?: string | null;
|
4182 | }
|
4183 |
|
4184 | // Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts
|
4185 | namespace JSX {
|
4186 | type ElementType = GlobalJSXElementType;
|
4187 | interface Element extends GlobalJSXElement {}
|
4188 | interface ElementClass extends GlobalJSXElementClass {}
|
4189 | interface ElementAttributesProperty extends GlobalJSXElementAttributesProperty {}
|
4190 | interface ElementChildrenAttribute extends GlobalJSXElementChildrenAttribute {}
|
4191 |
|
4192 | type LibraryManagedAttributes<C, P> = GlobalJSXLibraryManagedAttributes<C, P>;
|
4193 |
|
4194 | interface IntrinsicAttributes extends GlobalJSXIntrinsicAttributes {}
|
4195 | interface IntrinsicClassAttributes<T> extends GlobalJSXIntrinsicClassAttributes<T> {}
|
4196 | interface IntrinsicElements extends GlobalJSXIntrinsicElements {}
|
4197 | }
|
4198 | }
|
4199 |
|
4200 | // naked 'any' type in a conditional type will short circuit and union both the then/else branches
|
4201 | // so boolean is only resolved for T = any
|
4202 | type IsExactlyAny<T> = boolean extends (T extends never ? true : false) ? true : false;
|
4203 |
|
4204 | type ExactlyAnyPropertyKeys<T> = { [K in keyof T]: IsExactlyAny<T[K]> extends true ? K : never }[keyof T];
|
4205 | type NotExactlyAnyPropertyKeys<T> = Exclude<keyof T, ExactlyAnyPropertyKeys<T>>;
|
4206 |
|
4207 | // Try to resolve ill-defined props like for JS users: props can be any, or sometimes objects with properties of type any
|
4208 | type MergePropTypes<P, T> =
|
4209 | // Distribute over P in case it is a union type
|
4210 | P extends any
|
4211 | // If props is type any, use propTypes definitions
|
4212 | ? IsExactlyAny<P> extends true ? T
|
4213 | // If declared props have indexed properties, ignore inferred props entirely as keyof gets widened
|
4214 | : string extends keyof P ? P
|
4215 | // Prefer declared types which are not exactly any
|
4216 | :
|
4217 | & Pick<P, NotExactlyAnyPropertyKeys<P>>
|
4218 | // For props which are exactly any, use the type inferred from propTypes if present
|
4219 | & Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>>
|
4220 | // Keep leftover props not specified in propTypes
|
4221 | & Pick<P, Exclude<keyof P, keyof T>>
|
4222 | : never;
|
4223 |
|
4224 | type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
|
4225 |
|
4226 | // Any prop that has a default prop becomes optional, but its type is unchanged
|
4227 | // Undeclared default props are augmented into the resulting allowable attributes
|
4228 | // If declared props have indexed properties, ignore default props entirely as keyof gets widened
|
4229 | // Wrap in an outer-level conditional type to allow distribution over props that are unions
|
4230 | type Defaultize<P, D> = P extends any ? string extends keyof P ? P
|
4231 | :
|
4232 | & Pick<P, Exclude<keyof P, keyof D>>
|
4233 | & InexactPartial<Pick<P, Extract<keyof P, keyof D>>>
|
4234 | & InexactPartial<Pick<D, Exclude<keyof D, keyof P>>>
|
4235 | : never;
|
4236 |
|
4237 | type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D }
|
4238 | ? Defaultize<MergePropTypes<P, PropTypes.InferProps<T>>, D>
|
4239 | : C extends { propTypes: infer T } ? MergePropTypes<P, PropTypes.InferProps<T>>
|
4240 | : C extends { defaultProps: infer D } ? Defaultize<P, D>
|
4241 | : P;
|
4242 |
|
4243 | declare global {
|
4244 | /**
|
4245 | * @deprecated Use `React.JSX` instead of the global `JSX` namespace.
|
4246 | */
|
4247 | namespace JSX {
|
4248 | // We don't just alias React.ElementType because React.ElementType
|
4249 | // historically does more than we need it to.
|
4250 | // E.g. it also contains .propTypes and so TS also verifies the declared
|
4251 | // props type does match the declared .propTypes.
|
4252 | // But if libraries declared their .propTypes but not props type,
|
4253 | // or they mismatch, you won't be able to use the class component
|
4254 | // as a JSX.ElementType.
|
4255 | // We could fix this everywhere but we're ultimately not interested in
|
4256 | // .propTypes assignability so we might as well drop it entirely here to
|
4257 | // reduce the work of the type-checker.
|
4258 | // TODO: Check impact of making React.ElementType<P = any> = React.JSXElementConstructor<P>
|
4259 | type ElementType = string | React.JSXElementConstructor<any>;
|
4260 | interface Element extends React.ReactElement<any, any> {}
|
4261 | interface ElementClass extends React.Component<any> {
|
4262 | render(): React.ReactNode;
|
4263 | }
|
4264 | interface ElementAttributesProperty {
|
4265 | props: {};
|
4266 | }
|
4267 | interface ElementChildrenAttribute {
|
4268 | children: {};
|
4269 | }
|
4270 |
|
4271 | // We can't recurse forever because `type` can't be self-referential;
|
4272 | // let's assume it's reasonable to do a single React.lazy() around a single React.memo() / vice-versa
|
4273 | type LibraryManagedAttributes<C, P> = C extends
|
4274 | React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
|
4275 | ? T extends React.MemoExoticComponent<infer U> | React.LazyExoticComponent<infer U>
|
4276 | ? ReactManagedAttributes<U, P>
|
4277 | : ReactManagedAttributes<T, P>
|
4278 | : ReactManagedAttributes<C, P>;
|
4279 |
|
4280 | interface IntrinsicAttributes extends React.Attributes {}
|
4281 | interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {}
|
4282 |
|
4283 | interface IntrinsicElements {
|
4284 | // HTML
|
4285 | a: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
|
4286 | abbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4287 | address: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4288 | area: React.DetailedHTMLProps<React.AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
|
4289 | article: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4290 | aside: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4291 | audio: React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
|
4292 | b: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4293 | base: React.DetailedHTMLProps<React.BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>;
|
4294 | bdi: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4295 | bdo: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4296 | big: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4297 | blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
4298 | body: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
|
4299 | br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
|
4300 | button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
4301 | canvas: React.DetailedHTMLProps<React.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>;
|
4302 | caption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4303 | center: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4304 | cite: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4305 | code: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4306 | col: React.DetailedHTMLProps<React.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
4307 | colgroup: React.DetailedHTMLProps<React.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
|
4308 | data: React.DetailedHTMLProps<React.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>;
|
4309 | datalist: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
|
4310 | dd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4311 | del: React.DetailedHTMLProps<React.DelHTMLAttributes<HTMLModElement>, HTMLModElement>;
|
4312 | details: React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>;
|
4313 | dfn: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4314 | dialog: React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>;
|
4315 | div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
4316 | dl: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDListElement>, HTMLDListElement>;
|
4317 | dt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4318 | em: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4319 | embed: React.DetailedHTMLProps<React.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>;
|
4320 | fieldset: React.DetailedHTMLProps<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>;
|
4321 | figcaption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4322 | figure: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4323 | footer: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4324 | form: React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;
|
4325 | h1: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
4326 | h2: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
4327 | h3: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
4328 | h4: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
4329 | h5: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
4330 | h6: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
|
4331 | head: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>;
|
4332 | header: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4333 | hgroup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4334 | hr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHRElement>, HTMLHRElement>;
|
4335 | html: React.DetailedHTMLProps<React.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>;
|
4336 | i: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4337 | iframe: React.DetailedHTMLProps<React.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>;
|
4338 | img: React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
|
4339 | input: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
4340 | ins: React.DetailedHTMLProps<React.InsHTMLAttributes<HTMLModElement>, HTMLModElement>;
|
4341 | kbd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4342 | keygen: React.DetailedHTMLProps<React.KeygenHTMLAttributes<HTMLElement>, HTMLElement>;
|
4343 | label: React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
|
4344 | legend: React.DetailedHTMLProps<React.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>;
|
4345 | li: React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
|
4346 | link: React.DetailedHTMLProps<React.LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>;
|
4347 | main: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4348 | map: React.DetailedHTMLProps<React.MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>;
|
4349 | mark: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4350 | menu: React.DetailedHTMLProps<React.MenuHTMLAttributes<HTMLElement>, HTMLElement>;
|
4351 | menuitem: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4352 | meta: React.DetailedHTMLProps<React.MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
|
4353 | meter: React.DetailedHTMLProps<React.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>;
|
4354 | nav: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4355 | noindex: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4356 | noscript: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4357 | object: React.DetailedHTMLProps<React.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
|
4358 | ol: React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
|
4359 | optgroup: React.DetailedHTMLProps<React.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
|
4360 | option: React.DetailedHTMLProps<React.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
|
4361 | output: React.DetailedHTMLProps<React.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>;
|
4362 | p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
|
4363 | param: React.DetailedHTMLProps<React.ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
|
4364 | picture: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4365 | pre: React.DetailedHTMLProps<React.HTMLAttributes<HTMLPreElement>, HTMLPreElement>;
|
4366 | progress: React.DetailedHTMLProps<React.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>;
|
4367 | q: React.DetailedHTMLProps<React.QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
|
4368 | rp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4369 | rt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4370 | ruby: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4371 | s: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4372 | samp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4373 | search: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4374 | slot: React.DetailedHTMLProps<React.SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>;
|
4375 | script: React.DetailedHTMLProps<React.ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>;
|
4376 | section: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4377 | select: React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
|
4378 | small: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4379 | source: React.DetailedHTMLProps<React.SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>;
|
4380 | span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
|
4381 | strong: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4382 | style: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;
|
4383 | sub: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4384 | summary: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4385 | sup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4386 | table: React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>;
|
4387 | template: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>;
|
4388 | tbody: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
4389 | td: React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>;
|
4390 | textarea: React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
|
4391 | tfoot: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
4392 | th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
|
4393 | thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
|
4394 | time: React.DetailedHTMLProps<React.TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>;
|
4395 | title: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
|
4396 | tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
|
4397 | track: React.DetailedHTMLProps<React.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
|
4398 | u: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4399 | ul: React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>;
|
4400 | "var": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4401 | video: React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
|
4402 | wbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
4403 | webview: React.DetailedHTMLProps<React.WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>;
|
4404 |
|
4405 | // SVG
|
4406 | svg: React.SVGProps<SVGSVGElement>;
|
4407 |
|
4408 | animate: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateElement but is not in TypeScript's lib.dom.d.ts for now.
|
4409 | animateMotion: React.SVGProps<SVGElement>;
|
4410 | animateTransform: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateTransformElement but is not in TypeScript's lib.dom.d.ts for now.
|
4411 | circle: React.SVGProps<SVGCircleElement>;
|
4412 | clipPath: React.SVGProps<SVGClipPathElement>;
|
4413 | defs: React.SVGProps<SVGDefsElement>;
|
4414 | desc: React.SVGProps<SVGDescElement>;
|
4415 | ellipse: React.SVGProps<SVGEllipseElement>;
|
4416 | feBlend: React.SVGProps<SVGFEBlendElement>;
|
4417 | feColorMatrix: React.SVGProps<SVGFEColorMatrixElement>;
|
4418 | feComponentTransfer: React.SVGProps<SVGFEComponentTransferElement>;
|
4419 | feComposite: React.SVGProps<SVGFECompositeElement>;
|
4420 | feConvolveMatrix: React.SVGProps<SVGFEConvolveMatrixElement>;
|
4421 | feDiffuseLighting: React.SVGProps<SVGFEDiffuseLightingElement>;
|
4422 | feDisplacementMap: React.SVGProps<SVGFEDisplacementMapElement>;
|
4423 | feDistantLight: React.SVGProps<SVGFEDistantLightElement>;
|
4424 | feDropShadow: React.SVGProps<SVGFEDropShadowElement>;
|
4425 | feFlood: React.SVGProps<SVGFEFloodElement>;
|
4426 | feFuncA: React.SVGProps<SVGFEFuncAElement>;
|
4427 | feFuncB: React.SVGProps<SVGFEFuncBElement>;
|
4428 | feFuncG: React.SVGProps<SVGFEFuncGElement>;
|
4429 | feFuncR: React.SVGProps<SVGFEFuncRElement>;
|
4430 | feGaussianBlur: React.SVGProps<SVGFEGaussianBlurElement>;
|
4431 | feImage: React.SVGProps<SVGFEImageElement>;
|
4432 | feMerge: React.SVGProps<SVGFEMergeElement>;
|
4433 | feMergeNode: React.SVGProps<SVGFEMergeNodeElement>;
|
4434 | feMorphology: React.SVGProps<SVGFEMorphologyElement>;
|
4435 | feOffset: React.SVGProps<SVGFEOffsetElement>;
|
4436 | fePointLight: React.SVGProps<SVGFEPointLightElement>;
|
4437 | feSpecularLighting: React.SVGProps<SVGFESpecularLightingElement>;
|
4438 | feSpotLight: React.SVGProps<SVGFESpotLightElement>;
|
4439 | feTile: React.SVGProps<SVGFETileElement>;
|
4440 | feTurbulence: React.SVGProps<SVGFETurbulenceElement>;
|
4441 | filter: React.SVGProps<SVGFilterElement>;
|
4442 | foreignObject: React.SVGProps<SVGForeignObjectElement>;
|
4443 | g: React.SVGProps<SVGGElement>;
|
4444 | image: React.SVGProps<SVGImageElement>;
|
4445 | line: React.SVGLineElementAttributes<SVGLineElement>;
|
4446 | linearGradient: React.SVGProps<SVGLinearGradientElement>;
|
4447 | marker: React.SVGProps<SVGMarkerElement>;
|
4448 | mask: React.SVGProps<SVGMaskElement>;
|
4449 | metadata: React.SVGProps<SVGMetadataElement>;
|
4450 | mpath: React.SVGProps<SVGElement>;
|
4451 | path: React.SVGProps<SVGPathElement>;
|
4452 | pattern: React.SVGProps<SVGPatternElement>;
|
4453 | polygon: React.SVGProps<SVGPolygonElement>;
|
4454 | polyline: React.SVGProps<SVGPolylineElement>;
|
4455 | radialGradient: React.SVGProps<SVGRadialGradientElement>;
|
4456 | rect: React.SVGProps<SVGRectElement>;
|
4457 | set: React.SVGProps<SVGSetElement>;
|
4458 | stop: React.SVGProps<SVGStopElement>;
|
4459 | switch: React.SVGProps<SVGSwitchElement>;
|
4460 | symbol: React.SVGProps<SVGSymbolElement>;
|
4461 | text: React.SVGTextElementAttributes<SVGTextElement>;
|
4462 | textPath: React.SVGProps<SVGTextPathElement>;
|
4463 | tspan: React.SVGProps<SVGTSpanElement>;
|
4464 | use: React.SVGProps<SVGUseElement>;
|
4465 | view: React.SVGProps<SVGViewElement>;
|
4466 | }
|
4467 | }
|
4468 | }
|
4469 |
|
4470 | // React.JSX needs to point to global.JSX to keep global module augmentations intact.
|
4471 | // But we can't access global.JSX so we need to create these aliases instead.
|
4472 | // Once the global JSX namespace will be removed we replace React.JSX with the contents of global.JSX
|
4473 | type GlobalJSXElementType = JSX.ElementType;
|
4474 | interface GlobalJSXElement extends JSX.Element {}
|
4475 | interface GlobalJSXElementClass extends JSX.ElementClass {}
|
4476 | interface GlobalJSXElementAttributesProperty extends JSX.ElementAttributesProperty {}
|
4477 | interface GlobalJSXElementChildrenAttribute extends JSX.ElementChildrenAttribute {}
|
4478 |
|
4479 | type GlobalJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
|
4480 |
|
4481 | interface GlobalJSXIntrinsicAttributes extends JSX.IntrinsicAttributes {}
|
4482 | interface GlobalJSXIntrinsicClassAttributes<T> extends JSX.IntrinsicClassAttributes<T> {}
|
4483 |
|
4484 | interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {}
|
4485 |
|
\ | No newline at end of file |