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