@types/react 18.2.21 → 18.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
react/ts5.0/index.d.ts CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  /// <reference path="global.d.ts" />
6
6
 
7
- import * as CSS from 'csstype';
8
- import * as PropTypes from 'prop-types';
9
- import { Interaction as SchedulerInteraction } from 'scheduler/tracing';
7
+ import * as CSS from "csstype";
8
+ import * as PropTypes from "prop-types";
9
+ import { Interaction as SchedulerInteraction } from "scheduler/tracing";
10
10
 
11
11
  type NativeAnimationEvent = AnimationEvent;
12
12
  type NativeClipboardEvent = ClipboardEvent;
@@ -20,8 +20,8 @@ type NativePointerEvent = PointerEvent;
20
20
  type NativeTransitionEvent = TransitionEvent;
21
21
  type NativeUIEvent = UIEvent;
22
22
  type NativeWheelEvent = WheelEvent;
23
- type Booleanish = boolean | 'true' | 'false';
24
- type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;
23
+ type Booleanish = boolean | "true" | "false";
24
+ type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined;
25
25
 
26
26
  declare const UNDEFINED_VOID_ONLY: unique symbol;
27
27
  // Destructors are only allowed to return void.
@@ -38,27 +38,27 @@ declare namespace React {
38
38
  // ----------------------------------------------------------------------
39
39
 
40
40
  type ElementType<P = any> =
41
- {
42
- [K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never
43
- }[keyof JSX.IntrinsicElements] |
44
- ComponentType<P>;
41
+ | {
42
+ [K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never;
43
+ }[keyof JSX.IntrinsicElements]
44
+ | ComponentType<P>;
45
45
  type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
46
46
 
47
47
  type JSXElementConstructor<P> =
48
48
  | ((
49
- props: P,
50
- /**
51
- * @deprecated https://legacy.react/ts5.0js.org/docs/legacy-context.html#referencing-context-in-stateless-function-components
52
- */
53
- deprecatedLegacyContext?: any,
54
- ) => ReactElement<any, any> | null)
55
- | (new (
56
- props: P,
57
- /**
58
- * @deprecated https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods
59
- */
60
- deprecatedLegacyContext?: any,
61
- ) => Component<any, any>);
49
+ props: P,
50
+ /**
51
+ * @deprecated https://legacy.react/ts5.0js.org/docs/legacy-context.html#referencing-context-in-stateless-function-components
52
+ */
53
+ deprecatedLegacyContext?: any,
54
+ ) => ReactElement<any, any> | null)
55
+ | (new(
56
+ props: P,
57
+ /**
58
+ * @deprecated https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods
59
+ */
60
+ deprecatedLegacyContext?: any,
61
+ ) => Component<any, any>);
62
62
 
63
63
  interface RefObject<T> {
64
64
  readonly current: T | null;
@@ -87,23 +87,21 @@ declare namespace React {
87
87
  type ElementRef<
88
88
  C extends
89
89
  | ForwardRefExoticComponent<any>
90
- | { new (props: any): Component<any> }
90
+ | { new(props: any): Component<any> }
91
91
  | ((props: any, context?: any) => ReactElement | null)
92
- | keyof JSX.IntrinsicElements
92
+ | keyof JSX.IntrinsicElements,
93
93
  > =
94
94
  // need to check first if `ref` is a valid prop for ts@3.0
95
95
  // otherwise it will infer `{}` instead of `never`
96
- "ref" extends keyof ComponentPropsWithRef<C>
97
- ? NonNullable<ComponentPropsWithRef<C>["ref"]> extends Ref<
96
+ "ref" extends keyof ComponentPropsWithRef<C> ? NonNullable<ComponentPropsWithRef<C>["ref"]> extends Ref<
98
97
  infer Instance
99
- >
100
- ? Instance
101
- : never
98
+ > ? Instance
99
+ : never
102
100
  : never;
103
101
 
104
102
  type ComponentState = any;
105
103
 
106
- type Key = string | number;
104
+ type Key = string | number | bigint;
107
105
 
108
106
  /**
109
107
  * @internal You shouldn't need to use this type since you never see these attributes
@@ -129,7 +127,10 @@ declare namespace React {
129
127
  ref?: LegacyRef<T> | undefined;
130
128
  }
131
129
 
132
- interface ReactElement<P = any, T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>> {
130
+ interface ReactElement<
131
+ P = any,
132
+ T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>,
133
+ > {
133
134
  type: T;
134
135
  props: P;
135
136
  key: Key | null;
@@ -137,11 +138,11 @@ declare namespace React {
137
138
 
138
139
  interface ReactComponentElement<
139
140
  T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>,
140
- P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, 'key' | 'ref'>>
141
- > extends ReactElement<P, Exclude<T, number>> { }
141
+ P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, "key" | "ref">>,
142
+ > extends ReactElement<P, Exclude<T, number>> {}
142
143
 
143
144
  interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
144
- ref?: ('ref' extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
145
+ ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
145
146
  }
146
147
 
147
148
  type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>;
@@ -152,12 +153,14 @@ declare namespace React {
152
153
  type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
153
154
 
154
155
  // string fallback for custom web-components
155
- interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element> extends ReactElement<P, string> {
156
+ interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element>
157
+ extends ReactElement<P, string>
158
+ {
156
159
  ref: LegacyRef<T>;
157
160
  }
158
161
 
159
162
  // ReactHTML for ReactHTMLElement
160
- interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> { }
163
+ interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {}
161
164
 
162
165
  interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> {
163
166
  type: keyof ReactHTML;
@@ -184,16 +187,23 @@ declare namespace React {
184
187
  */
185
188
  type SFCFactory<P> = FunctionComponentFactory<P>;
186
189
 
187
- type FunctionComponentFactory<P> = (props?: Attributes & P, ...children: ReactNode[]) => FunctionComponentElement<P>;
190
+ type FunctionComponentFactory<P> = (
191
+ props?: Attributes & P,
192
+ ...children: ReactNode[]
193
+ ) => FunctionComponentElement<P>;
188
194
 
189
- type ComponentFactory<P, T extends Component<P, ComponentState>> =
190
- (props?: ClassAttributes<T> & P, ...children: ReactNode[]) => CElement<P, T>;
195
+ type ComponentFactory<P, T extends Component<P, ComponentState>> = (
196
+ props?: ClassAttributes<T> & P,
197
+ ...children: ReactNode[]
198
+ ) => CElement<P, T>;
191
199
 
192
200
  type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>;
193
201
  type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>;
194
202
 
195
- type DOMFactory<P extends DOMAttributes<T>, T extends Element> =
196
- (props?: ClassAttributes<T> & P | null, ...children: ReactNode[]) => DOMElement<P, T>;
203
+ type DOMFactory<P extends DOMAttributes<T>, T extends Element> = (
204
+ props?: ClassAttributes<T> & P | null,
205
+ ...children: ReactNode[]
206
+ ) => DOMElement<P, T>;
197
207
 
198
208
  interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {}
199
209
 
@@ -202,7 +212,10 @@ declare namespace React {
202
212
  }
203
213
 
204
214
  interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> {
205
- (props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null, ...children: ReactNode[]): ReactSVGElement;
215
+ (
216
+ props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null,
217
+ ...children: ReactNode[]
218
+ ): ReactSVGElement;
206
219
  }
207
220
 
208
221
  /**
@@ -239,7 +252,9 @@ declare namespace React {
239
252
  | boolean
240
253
  | null
241
254
  | undefined
242
- | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES];
255
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
256
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES
257
+ ];
243
258
 
244
259
  //
245
260
  // Top Level API
@@ -247,18 +262,23 @@ declare namespace React {
247
262
 
248
263
  // DOM Elements
249
264
  function createFactory<T extends HTMLElement>(
250
- type: keyof ReactHTML): HTMLFactory<T>;
265
+ type: keyof ReactHTML,
266
+ ): HTMLFactory<T>;
251
267
  function createFactory(
252
- type: keyof ReactSVG): SVGFactory;
268
+ type: keyof ReactSVG,
269
+ ): SVGFactory;
253
270
  function createFactory<P extends DOMAttributes<T>, T extends Element>(
254
- type: string): DOMFactory<P, T>;
271
+ type: string,
272
+ ): DOMFactory<P, T>;
255
273
 
256
274
  // Custom components
257
275
  function createFactory<P>(type: FunctionComponent<P>): FunctionComponentFactory<P>;
258
276
  function createFactory<P>(
259
- type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>): CFactory<P, ClassicComponent<P, ComponentState>>;
277
+ type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
278
+ ): CFactory<P, ClassicComponent<P, ComponentState>>;
260
279
  function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
261
- type: ClassType<P, T, C>): CFactory<P, T>;
280
+ type: ClassType<P, T, C>,
281
+ ): CFactory<P, T>;
262
282
  function createFactory<P>(type: ComponentClass<P>): Factory<P>;
263
283
 
264
284
  // DOM Elements
@@ -266,74 +286,89 @@ declare namespace React {
266
286
  function createElement(
267
287
  type: "input",
268
288
  props?: InputHTMLAttributes<HTMLInputElement> & ClassAttributes<HTMLInputElement> | null,
269
- ...children: ReactNode[]): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
289
+ ...children: ReactNode[]
290
+ ): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
270
291
  function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
271
292
  type: keyof ReactHTML,
272
293
  props?: ClassAttributes<T> & P | null,
273
- ...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
294
+ ...children: ReactNode[]
295
+ ): DetailedReactHTMLElement<P, T>;
274
296
  function createElement<P extends SVGAttributes<T>, T extends SVGElement>(
275
297
  type: keyof ReactSVG,
276
298
  props?: ClassAttributes<T> & P | null,
277
- ...children: ReactNode[]): ReactSVGElement;
299
+ ...children: ReactNode[]
300
+ ): ReactSVGElement;
278
301
  function createElement<P extends DOMAttributes<T>, T extends Element>(
279
302
  type: string,
280
303
  props?: ClassAttributes<T> & P | null,
281
- ...children: ReactNode[]): DOMElement<P, T>;
304
+ ...children: ReactNode[]
305
+ ): DOMElement<P, T>;
282
306
 
283
307
  // Custom components
284
308
 
285
309
  function createElement<P extends {}>(
286
310
  type: FunctionComponent<P>,
287
311
  props?: Attributes & P | null,
288
- ...children: ReactNode[]): FunctionComponentElement<P>;
312
+ ...children: ReactNode[]
313
+ ): FunctionComponentElement<P>;
289
314
  function createElement<P extends {}>(
290
315
  type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
291
316
  props?: ClassAttributes<ClassicComponent<P, ComponentState>> & P | null,
292
- ...children: ReactNode[]): CElement<P, ClassicComponent<P, ComponentState>>;
317
+ ...children: ReactNode[]
318
+ ): CElement<P, ClassicComponent<P, ComponentState>>;
293
319
  function createElement<P extends {}, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
294
320
  type: ClassType<P, T, C>,
295
321
  props?: ClassAttributes<T> & P | null,
296
- ...children: ReactNode[]): CElement<P, T>;
322
+ ...children: ReactNode[]
323
+ ): CElement<P, T>;
297
324
  function createElement<P extends {}>(
298
325
  type: FunctionComponent<P> | ComponentClass<P> | string,
299
326
  props?: Attributes & P | null,
300
- ...children: ReactNode[]): ReactElement<P>;
327
+ ...children: ReactNode[]
328
+ ): ReactElement<P>;
301
329
 
302
330
  // DOM Elements
303
331
  // ReactHTMLElement
304
332
  function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
305
333
  element: DetailedReactHTMLElement<P, T>,
306
334
  props?: P,
307
- ...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
335
+ ...children: ReactNode[]
336
+ ): DetailedReactHTMLElement<P, T>;
308
337
  // ReactHTMLElement, less specific
309
338
  function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
310
339
  element: ReactHTMLElement<T>,
311
340
  props?: P,
312
- ...children: ReactNode[]): ReactHTMLElement<T>;
341
+ ...children: ReactNode[]
342
+ ): ReactHTMLElement<T>;
313
343
  // SVGElement
314
344
  function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>(
315
345
  element: ReactSVGElement,
316
346
  props?: P,
317
- ...children: ReactNode[]): ReactSVGElement;
347
+ ...children: ReactNode[]
348
+ ): ReactSVGElement;
318
349
  // DOM Element (has to be the last, because type checking stops at first overload that fits)
319
350
  function cloneElement<P extends DOMAttributes<T>, T extends Element>(
320
351
  element: DOMElement<P, T>,
321
352
  props?: DOMAttributes<T> & P,
322
- ...children: ReactNode[]): DOMElement<P, T>;
353
+ ...children: ReactNode[]
354
+ ): DOMElement<P, T>;
323
355
 
324
356
  // Custom components
325
357
  function cloneElement<P>(
326
358
  element: FunctionComponentElement<P>,
327
359
  props?: Partial<P> & Attributes,
328
- ...children: ReactNode[]): FunctionComponentElement<P>;
360
+ ...children: ReactNode[]
361
+ ): FunctionComponentElement<P>;
329
362
  function cloneElement<P, T extends Component<P, ComponentState>>(
330
363
  element: CElement<P, T>,
331
364
  props?: Partial<P> & ClassAttributes<T>,
332
- ...children: ReactNode[]): CElement<P, T>;
365
+ ...children: ReactNode[]
366
+ ): CElement<P, T>;
333
367
  function cloneElement<P>(
334
368
  element: ReactElement<P>,
335
369
  props?: Partial<P> & Attributes,
336
- ...children: ReactNode[]): ReactElement<P>;
370
+ ...children: ReactNode[]
371
+ ): ReactElement<P>;
337
372
 
338
373
  // Context via RenderProps
339
374
  interface ProviderProps<T> {
@@ -359,7 +394,7 @@ declare namespace React {
359
394
  /**
360
395
  * **NOTE**: Exotic components are not callable.
361
396
  */
362
- (props: P): (ReactElement | null);
397
+ (props: P): ReactElement | null;
363
398
  readonly $$typeof: symbol;
364
399
  }
365
400
 
@@ -392,8 +427,10 @@ declare namespace React {
392
427
 
393
428
  // Sync with `ReactChildren` until `ReactChildren` is removed.
394
429
  const Children: {
395
- map<T, C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => T):
396
- C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
430
+ map<T, C>(
431
+ children: C | ReadonlyArray<C>,
432
+ fn: (child: C, index: number) => T,
433
+ ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
397
434
  forEach<C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => void): void;
398
435
  count(children: any): number;
399
436
  only<C>(children: C): C extends any[] ? never : C;
@@ -439,7 +476,7 @@ declare namespace React {
439
476
  type ReactInstance = Component<any> | Element;
440
477
 
441
478
  // Base component for plain JS classes
442
- interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> { }
479
+ interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {}
443
480
  class Component<P, S> {
444
481
  // tslint won't let me format the sample code in a way that vscode likes it :(
445
482
  /**
@@ -492,8 +529,8 @@ declare namespace React {
492
529
  // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
493
530
  // Also, the ` | S` allows intellisense to not be dumbisense
494
531
  setState<K extends keyof S>(
495
- state: ((prevState: Readonly<S>, props: Readonly<P>) => (Pick<S, K> | S | null)) | (Pick<S, K> | S | null),
496
- callback?: () => void
532
+ state: ((prevState: Readonly<S>, props: Readonly<P>) => Pick<S, K> | S | null) | (Pick<S, K> | S | null),
533
+ callback?: () => void,
497
534
  ): void;
498
535
 
499
536
  forceUpdate(callback?: () => void): void;
@@ -506,11 +543,11 @@ declare namespace React {
506
543
  * https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs
507
544
  */
508
545
  refs: {
509
- [key: string]: ReactInstance
546
+ [key: string]: ReactInstance;
510
547
  };
511
548
  }
512
549
 
513
- class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> { }
550
+ class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {}
514
551
 
515
552
  interface ClassicComponent<P = {}, S = {}> extends Component<P, S> {
516
553
  replaceState(nextState: S, callback?: () => void): void;
@@ -570,7 +607,7 @@ declare namespace React {
570
607
  }
571
608
 
572
609
  interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
573
- new (props: P, context?: any): Component<P, S>;
610
+ new(props: P, context?: any): Component<P, S>;
574
611
  propTypes?: WeakValidationMap<P> | undefined;
575
612
  contextType?: Context<any> | undefined;
576
613
  contextTypes?: ValidationMap<any> | undefined;
@@ -580,7 +617,7 @@ declare namespace React {
580
617
  }
581
618
 
582
619
  interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
583
- new (props: P, context?: any): ClassicComponent<P, ComponentState>;
620
+ new(props: P, context?: any): ClassicComponent<P, ComponentState>;
584
621
  getDefaultProps?(): P;
585
622
  }
586
623
 
@@ -590,8 +627,8 @@ declare namespace React {
590
627
  * See https://github.com/Microsoft/TypeScript/issues/7234 for more info.
591
628
  */
592
629
  type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
593
- C &
594
- (new (props: P, context?: any) => T);
630
+ & C
631
+ & (new(props: P, context?: any) => T);
595
632
 
596
633
  //
597
634
  // Component Specs and Lifecycle
@@ -789,23 +826,24 @@ declare namespace React {
789
826
  propTypes?: WeakValidationMap<P> | undefined;
790
827
  }
791
828
 
792
- function forwardRef<T, P = {}>(render: ForwardRefRenderFunction<T, P>): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
829
+ function forwardRef<T, P = {}>(
830
+ render: ForwardRefRenderFunction<T, P>,
831
+ ): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
793
832
 
794
833
  /** Ensures that the props do not include ref at all */
795
834
  type PropsWithoutRef<P> =
796
835
  // Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
797
836
  // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
798
837
  // https://github.com/Microsoft/TypeScript/issues/28339
799
- P extends any ? ('ref' extends keyof P ? Omit<P, 'ref'> : P) : P;
838
+ P extends any ? ("ref" extends keyof P ? Omit<P, "ref"> : P) : P;
800
839
  /** Ensures that the props do not include string ref, which cannot be forwarded */
801
840
  type PropsWithRef<P> =
802
841
  // Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}.
803
- 'ref' extends keyof P
842
+ "ref" extends keyof P
804
843
  ? P extends { ref?: infer R | undefined }
805
- ? string extends R
806
- ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
807
- : P
844
+ ? string extends R ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
808
845
  : P
846
+ : P
809
847
  : P;
810
848
 
811
849
  type PropsWithChildren<P = unknown> = P & { children?: ReactNode | undefined };
@@ -814,26 +852,20 @@ declare namespace React {
814
852
  * NOTE: prefer ComponentPropsWithRef, if the ref is forwarded,
815
853
  * or ComponentPropsWithoutRef when refs are not supported.
816
854
  */
817
- type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> =
818
- T extends JSXElementConstructor<infer P>
819
- ? P
820
- : T extends keyof JSX.IntrinsicElements
821
- ? JSX.IntrinsicElements[T]
822
- : {};
823
- type ComponentPropsWithRef<T extends ElementType> =
824
- T extends (new (props: infer P) => Component<any, any>)
825
- ? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
826
- : PropsWithRef<ComponentProps<T>>;
827
- type ComponentPropsWithoutRef<T extends ElementType> =
828
- PropsWithoutRef<ComponentProps<T>>;
855
+ type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends
856
+ JSXElementConstructor<infer P> ? P
857
+ : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T]
858
+ : {};
859
+ type ComponentPropsWithRef<T extends ElementType> = T extends (new(props: infer P) => Component<any, any>)
860
+ ? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
861
+ : PropsWithRef<ComponentProps<T>>;
862
+ type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;
829
863
 
830
864
  type ComponentRef<T extends ElementType> = T extends NamedExoticComponent<
831
865
  ComponentPropsWithoutRef<T> & RefAttributes<infer Method>
832
- >
833
- ? Method
834
- : ComponentPropsWithRef<T> extends RefAttributes<infer Method>
835
- ? Method
836
- : never;
866
+ > ? Method
867
+ : ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
868
+ : never;
837
869
 
838
870
  // will show `Memo(${Component.displayName || Component.name})` in devtools by default,
839
871
  // but can be given its own specific name
@@ -843,11 +875,11 @@ declare namespace React {
843
875
 
844
876
  function memo<P extends object>(
845
877
  Component: FunctionComponent<P>,
846
- propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean
878
+ propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean,
847
879
  ): NamedExoticComponent<P>;
848
880
  function memo<T extends ComponentType<any>>(
849
881
  Component: T,
850
- propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean
882
+ propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean,
851
883
  ): MemoExoticComponent<T>;
852
884
 
853
885
  type LazyExoticComponent<T extends ComponentType<any>> = ExoticComponent<ComponentPropsWithRef<T>> & {
@@ -855,7 +887,7 @@ declare namespace React {
855
887
  };
856
888
 
857
889
  function lazy<T extends ComponentType<any>>(
858
- factory: () => Promise<{ default: T }>
890
+ factory: () => Promise<{ default: T }>,
859
891
  ): LazyExoticComponent<T>;
860
892
 
861
893
  //
@@ -880,12 +912,12 @@ declare namespace React {
880
912
  type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
881
913
  type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never;
882
914
  // The identity check is done with the SameValue algorithm (Object.is), which is stricter than ===
883
- type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> =
884
- R extends ReducerWithoutAction<infer S> ? S : never;
915
+ type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> = R extends ReducerWithoutAction<infer S> ? S
916
+ : never;
885
917
  type DependencyList = ReadonlyArray<unknown>;
886
918
 
887
919
  // NOTE: callbacks are _only_ allowed to return either void, or a destructor.
888
- type EffectCallback = () => (void | Destructor);
920
+ type EffectCallback = () => void | Destructor;
889
921
 
890
922
  interface MutableRefObject<T> {
891
923
  current: T;
@@ -899,7 +931,7 @@ declare namespace React {
899
931
  * @version 16.8.0
900
932
  * @see https://react.dev/reference/react/useContext
901
933
  */
902
- function useContext<T>(context: Context<T>/*, (not public API) observedBits?: number|boolean */): T;
934
+ function useContext<T>(context: Context<T> /*, (not public API) observedBits?: number|boolean */): T;
903
935
  /**
904
936
  * Returns a stateful value, and a function to update it.
905
937
  *
@@ -929,7 +961,7 @@ declare namespace React {
929
961
  function useReducer<R extends ReducerWithoutAction<any>, I>(
930
962
  reducer: R,
931
963
  initializerArg: I,
932
- initializer: (arg: I) => ReducerStateWithoutAction<R>
964
+ initializer: (arg: I) => ReducerStateWithoutAction<R>,
933
965
  ): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
934
966
  /**
935
967
  * An alternative to `useState`.
@@ -945,7 +977,7 @@ declare namespace React {
945
977
  function useReducer<R extends ReducerWithoutAction<any>>(
946
978
  reducer: R,
947
979
  initializerArg: ReducerStateWithoutAction<R>,
948
- initializer?: undefined
980
+ initializer?: undefined,
949
981
  ): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
950
982
  /**
951
983
  * An alternative to `useState`.
@@ -963,7 +995,7 @@ declare namespace React {
963
995
  function useReducer<R extends Reducer<any, any>, I>(
964
996
  reducer: R,
965
997
  initializerArg: I & ReducerState<R>,
966
- initializer: (arg: I & ReducerState<R>) => ReducerState<R>
998
+ initializer: (arg: I & ReducerState<R>) => ReducerState<R>,
967
999
  ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
968
1000
  /**
969
1001
  * An alternative to `useState`.
@@ -979,7 +1011,7 @@ declare namespace React {
979
1011
  function useReducer<R extends Reducer<any, any>, I>(
980
1012
  reducer: R,
981
1013
  initializerArg: I,
982
- initializer: (arg: I) => ReducerState<R>
1014
+ initializer: (arg: I) => ReducerState<R>,
983
1015
  ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
984
1016
  /**
985
1017
  * An alternative to `useState`.
@@ -1004,7 +1036,7 @@ declare namespace React {
1004
1036
  function useReducer<R extends Reducer<any, any>>(
1005
1037
  reducer: R,
1006
1038
  initialState: ReducerState<R>,
1007
- initializer?: undefined
1039
+ initializer?: undefined,
1008
1040
  ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
1009
1041
  /**
1010
1042
  * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
@@ -1031,7 +1063,7 @@ declare namespace React {
1031
1063
  * @version 16.8.0
1032
1064
  * @see https://react.dev/reference/react/useRef
1033
1065
  */
1034
- function useRef<T>(initialValue: T|null): RefObject<T>;
1066
+ function useRef<T>(initialValue: T | null): RefObject<T>;
1035
1067
  // convenience overload for potentially undefined initialValue / call with 0 arguments
1036
1068
  // has a default to stop it from defaulting to {} instead
1037
1069
  /**
@@ -1079,7 +1111,7 @@ declare namespace React {
1079
1111
  * @version 16.8.0
1080
1112
  * @see https://react.dev/reference/react/useImperativeHandle
1081
1113
  */
1082
- function useImperativeHandle<T, R extends T>(ref: Ref<T>|undefined, init: () => R, deps?: DependencyList): void;
1114
+ function useImperativeHandle<T, R extends T>(ref: Ref<T> | undefined, init: () => R, deps?: DependencyList): void;
1083
1115
  // I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key
1084
1116
  // useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y.
1085
1117
  /**
@@ -1174,7 +1206,7 @@ declare namespace React {
1174
1206
  *
1175
1207
  * @see https://github.com/facebook/react/pull/21913
1176
1208
  */
1177
- export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
1209
+ export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
1178
1210
 
1179
1211
  /**
1180
1212
  * @param subscribe
@@ -1241,7 +1273,7 @@ declare namespace React {
1241
1273
  twist: number;
1242
1274
  width: number;
1243
1275
  height: number;
1244
- pointerType: 'mouse' | 'pen' | 'touch';
1276
+ pointerType: "mouse" | "pen" | "touch";
1245
1277
  isPrimary: boolean;
1246
1278
  }
1247
1279
 
@@ -1261,7 +1293,21 @@ declare namespace React {
1261
1293
  target: EventTarget & T;
1262
1294
  }
1263
1295
 
1264
- export type ModifierKey = "Alt" | "AltGraph" | "CapsLock" | "Control" | "Fn" | "FnLock" | "Hyper" | "Meta" | "NumLock" | "ScrollLock" | "Shift" | "Super" | "Symbol" | "SymbolLock";
1296
+ export type ModifierKey =
1297
+ | "Alt"
1298
+ | "AltGraph"
1299
+ | "CapsLock"
1300
+ | "Control"
1301
+ | "Fn"
1302
+ | "FnLock"
1303
+ | "Hyper"
1304
+ | "Meta"
1305
+ | "NumLock"
1306
+ | "ScrollLock"
1307
+ | "Shift"
1308
+ | "Super"
1309
+ | "Symbol"
1310
+ | "SymbolLock";
1265
1311
 
1266
1312
  interface KeyboardEvent<T = Element> extends UIEvent<T, NativeKeyboardEvent> {
1267
1313
  altKey: boolean;
@@ -1603,287 +1649,298 @@ declare namespace React {
1603
1649
  // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/
1604
1650
  interface AriaAttributes {
1605
1651
  /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */
1606
- 'aria-activedescendant'?: string | undefined;
1652
+ "aria-activedescendant"?: string | undefined;
1607
1653
  /** 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. */
1608
- 'aria-atomic'?: Booleanish | undefined;
1654
+ "aria-atomic"?: Booleanish | undefined;
1609
1655
  /**
1610
1656
  * 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
1611
1657
  * presented if they are made.
1612
1658
  */
1613
- 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both' | undefined;
1659
+ "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
1614
1660
  /** 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. */
1615
1661
  /**
1616
1662
  * Defines a string value that labels the current element, which is intended to be converted into Braille.
1617
1663
  * @see aria-label.
1618
1664
  */
1619
- 'aria-braillelabel'?: string | undefined;
1665
+ "aria-braillelabel"?: string | undefined;
1620
1666
  /**
1621
1667
  * Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.
1622
1668
  * @see aria-roledescription.
1623
1669
  */
1624
- 'aria-brailleroledescription'?: string | undefined;
1625
- 'aria-busy'?: Booleanish | undefined;
1670
+ "aria-brailleroledescription"?: string | undefined;
1671
+ "aria-busy"?: Booleanish | undefined;
1626
1672
  /**
1627
1673
  * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
1628
1674
  * @see aria-pressed @see aria-selected.
1629
1675
  */
1630
- 'aria-checked'?: boolean | 'false' | 'mixed' | 'true' | undefined;
1676
+ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
1631
1677
  /**
1632
1678
  * Defines the total number of columns in a table, grid, or treegrid.
1633
1679
  * @see aria-colindex.
1634
1680
  */
1635
- 'aria-colcount'?: number | undefined;
1681
+ "aria-colcount"?: number | undefined;
1636
1682
  /**
1637
1683
  * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
1638
1684
  * @see aria-colcount @see aria-colspan.
1639
1685
  */
1640
- 'aria-colindex'?: number | undefined;
1686
+ "aria-colindex"?: number | undefined;
1641
1687
  /**
1642
1688
  * Defines a human readable text alternative of aria-colindex.
1643
1689
  * @see aria-rowindextext.
1644
1690
  */
1645
- 'aria-colindextext'?: string | undefined;
1691
+ "aria-colindextext"?: string | undefined;
1646
1692
  /**
1647
1693
  * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
1648
1694
  * @see aria-colindex @see aria-rowspan.
1649
1695
  */
1650
- 'aria-colspan'?: number | undefined;
1696
+ "aria-colspan"?: number | undefined;
1651
1697
  /**
1652
1698
  * Identifies the element (or elements) whose contents or presence are controlled by the current element.
1653
1699
  * @see aria-owns.
1654
1700
  */
1655
- 'aria-controls'?: string | undefined;
1701
+ "aria-controls"?: string | undefined;
1656
1702
  /** Indicates the element that represents the current item within a container or set of related elements. */
1657
- 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time' | undefined;
1703
+ "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
1658
1704
  /**
1659
1705
  * Identifies the element (or elements) that describes the object.
1660
1706
  * @see aria-labelledby
1661
1707
  */
1662
- 'aria-describedby'?: string | undefined;
1708
+ "aria-describedby"?: string | undefined;
1663
1709
  /**
1664
1710
  * Defines a string value that describes or annotates the current element.
1665
1711
  * @see related aria-describedby.
1666
1712
  */
1667
- 'aria-description'?: string | undefined;
1713
+ "aria-description"?: string | undefined;
1668
1714
  /**
1669
1715
  * Identifies the element that provides a detailed, extended description for the object.
1670
1716
  * @see aria-describedby.
1671
1717
  */
1672
- 'aria-details'?: string | undefined;
1718
+ "aria-details"?: string | undefined;
1673
1719
  /**
1674
1720
  * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
1675
1721
  * @see aria-hidden @see aria-readonly.
1676
1722
  */
1677
- 'aria-disabled'?: Booleanish | undefined;
1723
+ "aria-disabled"?: Booleanish | undefined;
1678
1724
  /**
1679
1725
  * Indicates what functions can be performed when a dragged object is released on the drop target.
1680
1726
  * @deprecated in ARIA 1.1
1681
1727
  */
1682
- 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup' | undefined;
1728
+ "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
1683
1729
  /**
1684
1730
  * Identifies the element that provides an error message for the object.
1685
1731
  * @see aria-invalid @see aria-describedby.
1686
1732
  */
1687
- 'aria-errormessage'?: string | undefined;
1733
+ "aria-errormessage"?: string | undefined;
1688
1734
  /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */
1689
- 'aria-expanded'?: Booleanish | undefined;
1735
+ "aria-expanded"?: Booleanish | undefined;
1690
1736
  /**
1691
1737
  * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,
1692
1738
  * allows assistive technology to override the general default of reading in document source order.
1693
1739
  */
1694
- 'aria-flowto'?: string | undefined;
1740
+ "aria-flowto"?: string | undefined;
1695
1741
  /**
1696
1742
  * Indicates an element's "grabbed" state in a drag-and-drop operation.
1697
1743
  * @deprecated in ARIA 1.1
1698
1744
  */
1699
- 'aria-grabbed'?: Booleanish | undefined;
1745
+ "aria-grabbed"?: Booleanish | undefined;
1700
1746
  /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */
1701
- 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | undefined;
1747
+ "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
1702
1748
  /**
1703
1749
  * Indicates whether the element is exposed to an accessibility API.
1704
1750
  * @see aria-disabled.
1705
1751
  */
1706
- 'aria-hidden'?: Booleanish | undefined;
1752
+ "aria-hidden"?: Booleanish | undefined;
1707
1753
  /**
1708
1754
  * Indicates the entered value does not conform to the format expected by the application.
1709
1755
  * @see aria-errormessage.
1710
1756
  */
1711
- 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling' | undefined;
1757
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
1712
1758
  /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */
1713
- 'aria-keyshortcuts'?: string | undefined;
1759
+ "aria-keyshortcuts"?: string | undefined;
1714
1760
  /**
1715
1761
  * Defines a string value that labels the current element.
1716
1762
  * @see aria-labelledby.
1717
1763
  */
1718
- 'aria-label'?: string | undefined;
1764
+ "aria-label"?: string | undefined;
1719
1765
  /**
1720
1766
  * Identifies the element (or elements) that labels the current element.
1721
1767
  * @see aria-describedby.
1722
1768
  */
1723
- 'aria-labelledby'?: string | undefined;
1769
+ "aria-labelledby"?: string | undefined;
1724
1770
  /** Defines the hierarchical level of an element within a structure. */
1725
- 'aria-level'?: number | undefined;
1771
+ "aria-level"?: number | undefined;
1726
1772
  /** 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. */
1727
- 'aria-live'?: 'off' | 'assertive' | 'polite' | undefined;
1773
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
1728
1774
  /** Indicates whether an element is modal when displayed. */
1729
- 'aria-modal'?: Booleanish | undefined;
1775
+ "aria-modal"?: Booleanish | undefined;
1730
1776
  /** Indicates whether a text box accepts multiple lines of input or only a single line. */
1731
- 'aria-multiline'?: Booleanish | undefined;
1777
+ "aria-multiline"?: Booleanish | undefined;
1732
1778
  /** Indicates that the user may select more than one item from the current selectable descendants. */
1733
- 'aria-multiselectable'?: Booleanish | undefined;
1779
+ "aria-multiselectable"?: Booleanish | undefined;
1734
1780
  /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */
1735
- 'aria-orientation'?: 'horizontal' | 'vertical' | undefined;
1781
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
1736
1782
  /**
1737
1783
  * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship
1738
1784
  * between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
1739
1785
  * @see aria-controls.
1740
1786
  */
1741
- 'aria-owns'?: string | undefined;
1787
+ "aria-owns"?: string | undefined;
1742
1788
  /**
1743
1789
  * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.
1744
1790
  * A hint could be a sample value or a brief description of the expected format.
1745
1791
  */
1746
- 'aria-placeholder'?: string | undefined;
1792
+ "aria-placeholder"?: string | undefined;
1747
1793
  /**
1748
1794
  * 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.
1749
1795
  * @see aria-setsize.
1750
1796
  */
1751
- 'aria-posinset'?: number | undefined;
1797
+ "aria-posinset"?: number | undefined;
1752
1798
  /**
1753
1799
  * Indicates the current "pressed" state of toggle buttons.
1754
1800
  * @see aria-checked @see aria-selected.
1755
1801
  */
1756
- 'aria-pressed'?: boolean | 'false' | 'mixed' | 'true' | undefined;
1802
+ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
1757
1803
  /**
1758
1804
  * Indicates that the element is not editable, but is otherwise operable.
1759
1805
  * @see aria-disabled.
1760
1806
  */
1761
- 'aria-readonly'?: Booleanish | undefined;
1807
+ "aria-readonly"?: Booleanish | undefined;
1762
1808
  /**
1763
1809
  * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
1764
1810
  * @see aria-atomic.
1765
1811
  */
1766
- 'aria-relevant'?: 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' | undefined;
1812
+ "aria-relevant"?:
1813
+ | "additions"
1814
+ | "additions removals"
1815
+ | "additions text"
1816
+ | "all"
1817
+ | "removals"
1818
+ | "removals additions"
1819
+ | "removals text"
1820
+ | "text"
1821
+ | "text additions"
1822
+ | "text removals"
1823
+ | undefined;
1767
1824
  /** Indicates that user input is required on the element before a form may be submitted. */
1768
- 'aria-required'?: Booleanish | undefined;
1825
+ "aria-required"?: Booleanish | undefined;
1769
1826
  /** Defines a human-readable, author-localized description for the role of an element. */
1770
- 'aria-roledescription'?: string | undefined;
1827
+ "aria-roledescription"?: string | undefined;
1771
1828
  /**
1772
1829
  * Defines the total number of rows in a table, grid, or treegrid.
1773
1830
  * @see aria-rowindex.
1774
1831
  */
1775
- 'aria-rowcount'?: number | undefined;
1832
+ "aria-rowcount"?: number | undefined;
1776
1833
  /**
1777
1834
  * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
1778
1835
  * @see aria-rowcount @see aria-rowspan.
1779
1836
  */
1780
- 'aria-rowindex'?: number | undefined;
1837
+ "aria-rowindex"?: number | undefined;
1781
1838
  /**
1782
1839
  * Defines a human readable text alternative of aria-rowindex.
1783
1840
  * @see aria-colindextext.
1784
1841
  */
1785
- 'aria-rowindextext'?: string | undefined;
1842
+ "aria-rowindextext"?: string | undefined;
1786
1843
  /**
1787
1844
  * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
1788
1845
  * @see aria-rowindex @see aria-colspan.
1789
1846
  */
1790
- 'aria-rowspan'?: number | undefined;
1847
+ "aria-rowspan"?: number | undefined;
1791
1848
  /**
1792
1849
  * Indicates the current "selected" state of various widgets.
1793
1850
  * @see aria-checked @see aria-pressed.
1794
1851
  */
1795
- 'aria-selected'?: Booleanish | undefined;
1852
+ "aria-selected"?: Booleanish | undefined;
1796
1853
  /**
1797
1854
  * 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.
1798
1855
  * @see aria-posinset.
1799
1856
  */
1800
- 'aria-setsize'?: number | undefined;
1857
+ "aria-setsize"?: number | undefined;
1801
1858
  /** Indicates if items in a table or grid are sorted in ascending or descending order. */
1802
- 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' | undefined;
1859
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
1803
1860
  /** Defines the maximum allowed value for a range widget. */
1804
- 'aria-valuemax'?: number | undefined;
1861
+ "aria-valuemax"?: number | undefined;
1805
1862
  /** Defines the minimum allowed value for a range widget. */
1806
- 'aria-valuemin'?: number | undefined;
1863
+ "aria-valuemin"?: number | undefined;
1807
1864
  /**
1808
1865
  * Defines the current value for a range widget.
1809
1866
  * @see aria-valuetext.
1810
1867
  */
1811
- 'aria-valuenow'?: number | undefined;
1868
+ "aria-valuenow"?: number | undefined;
1812
1869
  /** Defines the human readable text alternative of aria-valuenow for a range widget. */
1813
- 'aria-valuetext'?: string | undefined;
1870
+ "aria-valuetext"?: string | undefined;
1814
1871
  }
1815
1872
 
1816
1873
  // All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions
1817
1874
  type AriaRole =
1818
- | 'alert'
1819
- | 'alertdialog'
1820
- | 'application'
1821
- | 'article'
1822
- | 'banner'
1823
- | 'button'
1824
- | 'cell'
1825
- | 'checkbox'
1826
- | 'columnheader'
1827
- | 'combobox'
1828
- | 'complementary'
1829
- | 'contentinfo'
1830
- | 'definition'
1831
- | 'dialog'
1832
- | 'directory'
1833
- | 'document'
1834
- | 'feed'
1835
- | 'figure'
1836
- | 'form'
1837
- | 'grid'
1838
- | 'gridcell'
1839
- | 'group'
1840
- | 'heading'
1841
- | 'img'
1842
- | 'link'
1843
- | 'list'
1844
- | 'listbox'
1845
- | 'listitem'
1846
- | 'log'
1847
- | 'main'
1848
- | 'marquee'
1849
- | 'math'
1850
- | 'menu'
1851
- | 'menubar'
1852
- | 'menuitem'
1853
- | 'menuitemcheckbox'
1854
- | 'menuitemradio'
1855
- | 'navigation'
1856
- | 'none'
1857
- | 'note'
1858
- | 'option'
1859
- | 'presentation'
1860
- | 'progressbar'
1861
- | 'radio'
1862
- | 'radiogroup'
1863
- | 'region'
1864
- | 'row'
1865
- | 'rowgroup'
1866
- | 'rowheader'
1867
- | 'scrollbar'
1868
- | 'search'
1869
- | 'searchbox'
1870
- | 'separator'
1871
- | 'slider'
1872
- | 'spinbutton'
1873
- | 'status'
1874
- | 'switch'
1875
- | 'tab'
1876
- | 'table'
1877
- | 'tablist'
1878
- | 'tabpanel'
1879
- | 'term'
1880
- | 'textbox'
1881
- | 'timer'
1882
- | 'toolbar'
1883
- | 'tooltip'
1884
- | 'tree'
1885
- | 'treegrid'
1886
- | 'treeitem'
1875
+ | "alert"
1876
+ | "alertdialog"
1877
+ | "application"
1878
+ | "article"
1879
+ | "banner"
1880
+ | "button"
1881
+ | "cell"
1882
+ | "checkbox"
1883
+ | "columnheader"
1884
+ | "combobox"
1885
+ | "complementary"
1886
+ | "contentinfo"
1887
+ | "definition"
1888
+ | "dialog"
1889
+ | "directory"
1890
+ | "document"
1891
+ | "feed"
1892
+ | "figure"
1893
+ | "form"
1894
+ | "grid"
1895
+ | "gridcell"
1896
+ | "group"
1897
+ | "heading"
1898
+ | "img"
1899
+ | "link"
1900
+ | "list"
1901
+ | "listbox"
1902
+ | "listitem"
1903
+ | "log"
1904
+ | "main"
1905
+ | "marquee"
1906
+ | "math"
1907
+ | "menu"
1908
+ | "menubar"
1909
+ | "menuitem"
1910
+ | "menuitemcheckbox"
1911
+ | "menuitemradio"
1912
+ | "navigation"
1913
+ | "none"
1914
+ | "note"
1915
+ | "option"
1916
+ | "presentation"
1917
+ | "progressbar"
1918
+ | "radio"
1919
+ | "radiogroup"
1920
+ | "region"
1921
+ | "row"
1922
+ | "rowgroup"
1923
+ | "rowheader"
1924
+ | "scrollbar"
1925
+ | "search"
1926
+ | "searchbox"
1927
+ | "separator"
1928
+ | "slider"
1929
+ | "spinbutton"
1930
+ | "status"
1931
+ | "switch"
1932
+ | "tab"
1933
+ | "table"
1934
+ | "tablist"
1935
+ | "tabpanel"
1936
+ | "term"
1937
+ | "textbox"
1938
+ | "timer"
1939
+ | "toolbar"
1940
+ | "tooltip"
1941
+ | "tree"
1942
+ | "treegrid"
1943
+ | "treeitem"
1887
1944
  | (string & {});
1888
1945
 
1889
1946
  interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
@@ -1911,7 +1968,7 @@ declare namespace React {
1911
1968
  style?: CSSProperties | undefined;
1912
1969
  tabIndex?: number | undefined;
1913
1970
  title?: string | undefined;
1914
- translate?: 'yes' | 'no' | undefined;
1971
+ translate?: "yes" | "no" | undefined;
1915
1972
 
1916
1973
  // Unknown
1917
1974
  radioGroup?: string | undefined; // <command>, <menuitem>
@@ -1944,14 +2001,14 @@ declare namespace React {
1944
2001
  itemRef?: string | undefined;
1945
2002
  results?: number | undefined;
1946
2003
  security?: string | undefined;
1947
- unselectable?: 'on' | 'off' | undefined;
2004
+ unselectable?: "on" | "off" | undefined;
1948
2005
 
1949
2006
  // Living Standard
1950
2007
  /**
1951
2008
  * Hints at the type of data that might be entered by the user while editing the element or its contents
1952
2009
  * @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute
1953
2010
  */
1954
- inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' | undefined;
2011
+ inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
1955
2012
  /**
1956
2013
  * Specify that a standard HTML element should behave like a defined custom built-in element
1957
2014
  * @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is
@@ -1973,7 +2030,9 @@ declare namespace React {
1973
2030
  action?:
1974
2031
  | string
1975
2032
  | undefined
1976
- | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS];
2033
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
2034
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
2035
+ ];
1977
2036
  allowFullScreen?: boolean | undefined;
1978
2037
  allowTransparency?: boolean | undefined;
1979
2038
  alt?: string | undefined;
@@ -1981,7 +2040,7 @@ declare namespace React {
1981
2040
  async?: boolean | undefined;
1982
2041
  autoComplete?: string | undefined;
1983
2042
  autoPlay?: boolean | undefined;
1984
- capture?: boolean | 'user' | 'environment' | undefined;
2043
+ capture?: boolean | "user" | "environment" | undefined;
1985
2044
  cellPadding?: number | string | undefined;
1986
2045
  cellSpacing?: number | string | undefined;
1987
2046
  charSet?: string | undefined;
@@ -2005,7 +2064,9 @@ declare namespace React {
2005
2064
  formAction?:
2006
2065
  | string
2007
2066
  | undefined
2008
- | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS];
2067
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
2068
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
2069
+ ];
2009
2070
  formEncType?: string | undefined;
2010
2071
  formMethod?: string | undefined;
2011
2072
  formNoValidate?: boolean | undefined;
@@ -2079,21 +2140,21 @@ declare namespace React {
2079
2140
  }
2080
2141
 
2081
2142
  type HTMLAttributeReferrerPolicy =
2082
- | ''
2083
- | 'no-referrer'
2084
- | 'no-referrer-when-downgrade'
2085
- | 'origin'
2086
- | 'origin-when-cross-origin'
2087
- | 'same-origin'
2088
- | 'strict-origin'
2089
- | 'strict-origin-when-cross-origin'
2090
- | 'unsafe-url';
2143
+ | ""
2144
+ | "no-referrer"
2145
+ | "no-referrer-when-downgrade"
2146
+ | "origin"
2147
+ | "origin-when-cross-origin"
2148
+ | "same-origin"
2149
+ | "strict-origin"
2150
+ | "strict-origin-when-cross-origin"
2151
+ | "unsafe-url";
2091
2152
 
2092
2153
  type HTMLAttributeAnchorTarget =
2093
- | '_self'
2094
- | '_blank'
2095
- | '_parent'
2096
- | '_top'
2154
+ | "_self"
2155
+ | "_blank"
2156
+ | "_parent"
2157
+ | "_top"
2097
2158
  | (string & {});
2098
2159
 
2099
2160
  interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -2135,14 +2196,16 @@ declare namespace React {
2135
2196
  form?: string | undefined;
2136
2197
  formAction?:
2137
2198
  | string
2138
- | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS]
2199
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
2200
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
2201
+ ]
2139
2202
  | undefined;
2140
2203
  formEncType?: string | undefined;
2141
2204
  formMethod?: string | undefined;
2142
2205
  formNoValidate?: boolean | undefined;
2143
2206
  formTarget?: string | undefined;
2144
2207
  name?: string | undefined;
2145
- type?: 'submit' | 'reset' | 'button' | undefined;
2208
+ type?: "submit" | "reset" | "button" | undefined;
2146
2209
  value?: string | ReadonlyArray<string> | number | undefined;
2147
2210
  }
2148
2211
 
@@ -2175,8 +2238,8 @@ declare namespace React {
2175
2238
  }
2176
2239
 
2177
2240
  interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
2178
- onCancel?: ReactEventHandler<T> | undefined;
2179
- onClose?: ReactEventHandler<T> | undefined;
2241
+ onCancel?: ReactEventHandler<T> | undefined;
2242
+ onClose?: ReactEventHandler<T> | undefined;
2180
2243
  open?: boolean | undefined;
2181
2244
  }
2182
2245
 
@@ -2198,7 +2261,9 @@ declare namespace React {
2198
2261
  action?:
2199
2262
  | string
2200
2263
  | undefined
2201
- | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS];
2264
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
2265
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
2266
+ ];
2202
2267
  autoComplete?: string | undefined;
2203
2268
  encType?: string | undefined;
2204
2269
  method?: string | undefined;
@@ -2254,42 +2319,44 @@ declare namespace React {
2254
2319
  }
2255
2320
 
2256
2321
  type HTMLInputTypeAttribute =
2257
- | 'button'
2258
- | 'checkbox'
2259
- | 'color'
2260
- | 'date'
2261
- | 'datetime-local'
2262
- | 'email'
2263
- | 'file'
2264
- | 'hidden'
2265
- | 'image'
2266
- | 'month'
2267
- | 'number'
2268
- | 'password'
2269
- | 'radio'
2270
- | 'range'
2271
- | 'reset'
2272
- | 'search'
2273
- | 'submit'
2274
- | 'tel'
2275
- | 'text'
2276
- | 'time'
2277
- | 'url'
2278
- | 'week'
2322
+ | "button"
2323
+ | "checkbox"
2324
+ | "color"
2325
+ | "date"
2326
+ | "datetime-local"
2327
+ | "email"
2328
+ | "file"
2329
+ | "hidden"
2330
+ | "image"
2331
+ | "month"
2332
+ | "number"
2333
+ | "password"
2334
+ | "radio"
2335
+ | "range"
2336
+ | "reset"
2337
+ | "search"
2338
+ | "submit"
2339
+ | "tel"
2340
+ | "text"
2341
+ | "time"
2342
+ | "url"
2343
+ | "week"
2279
2344
  | (string & {});
2280
2345
 
2281
2346
  interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
2282
2347
  accept?: string | undefined;
2283
2348
  alt?: string | undefined;
2284
2349
  autoComplete?: string | undefined;
2285
- capture?: boolean | 'user' | 'environment' | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
2350
+ capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
2286
2351
  checked?: boolean | undefined;
2287
2352
  disabled?: boolean | undefined;
2288
- enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined;
2353
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
2289
2354
  form?: string | undefined;
2290
2355
  formAction?:
2291
2356
  | string
2292
- | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS]
2357
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[
2358
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS
2359
+ ]
2293
2360
  | undefined;
2294
2361
  formEncType?: string | undefined;
2295
2362
  formMethod?: string | undefined;
@@ -2408,7 +2475,7 @@ declare namespace React {
2408
2475
  interface OlHTMLAttributes<T> extends HTMLAttributes<T> {
2409
2476
  reversed?: boolean | undefined;
2410
2477
  start?: number | undefined;
2411
- type?: '1' | 'a' | 'A' | 'i' | 'I' | undefined;
2478
+ type?: "1" | "a" | "A" | "i" | "I" | undefined;
2412
2479
  }
2413
2480
 
2414
2481
  interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -2595,8 +2662,21 @@ declare namespace React {
2595
2662
  accentHeight?: number | string | undefined;
2596
2663
  accumulate?: "none" | "sum" | undefined;
2597
2664
  additive?: "replace" | "sum" | undefined;
2598
- alignmentBaseline?: "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" |
2599
- "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" | undefined;
2665
+ alignmentBaseline?:
2666
+ | "auto"
2667
+ | "baseline"
2668
+ | "before-edge"
2669
+ | "text-before-edge"
2670
+ | "middle"
2671
+ | "central"
2672
+ | "after-edge"
2673
+ | "text-after-edge"
2674
+ | "ideographic"
2675
+ | "alphabetic"
2676
+ | "hanging"
2677
+ | "mathematical"
2678
+ | "inherit"
2679
+ | undefined;
2600
2680
  allowReorder?: "no" | "yes" | undefined;
2601
2681
  alphabetic?: number | string | undefined;
2602
2682
  amplitude?: number | string | undefined;
@@ -3039,7 +3119,7 @@ declare namespace React {
3039
3119
  view: SVGFactory;
3040
3120
  }
3041
3121
 
3042
- interface ReactDOM extends ReactHTML, ReactSVG { }
3122
+ interface ReactDOM extends ReactHTML, ReactSVG {}
3043
3123
 
3044
3124
  //
3045
3125
  // React.PropTypes
@@ -3052,11 +3132,9 @@ declare namespace React {
3052
3132
  type ValidationMap<T> = PropTypes.ValidationMap<T>;
3053
3133
 
3054
3134
  type WeakValidationMap<T> = {
3055
- [K in keyof T]?: null extends T[K]
3056
- ? Validator<T[K] | null | undefined>
3057
- : undefined extends T[K]
3058
- ? Validator<T[K] | null | undefined>
3059
- : Validator<T[K]>
3135
+ [K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined>
3136
+ : undefined extends T[K] ? Validator<T[K] | null | undefined>
3137
+ : Validator<T[K]>;
3060
3138
  };
3061
3139
 
3062
3140
  interface ReactPropTypes {
@@ -3087,8 +3165,10 @@ declare namespace React {
3087
3165
  */
3088
3166
  // Sync with type of `const Children`.
3089
3167
  interface ReactChildren {
3090
- map<T, C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => T):
3091
- C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
3168
+ map<T, C>(
3169
+ children: C | ReadonlyArray<C>,
3170
+ fn: (child: C, index: number) => T,
3171
+ ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
3092
3172
  forEach<C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => void): void;
3093
3173
  count(children: any): number;
3094
3174
  only<C>(children: C): C extends any[] ? never : C;
@@ -3159,15 +3239,16 @@ type MergePropTypes<P, T> =
3159
3239
  // Distribute over P in case it is a union type
3160
3240
  P extends any
3161
3241
  // If props is type any, use propTypes definitions
3162
- ? IsExactlyAny<P> extends true ? T :
3242
+ ? IsExactlyAny<P> extends true ? T
3163
3243
  // If declared props have indexed properties, ignore inferred props entirely as keyof gets widened
3164
- string extends keyof P ? P :
3165
- // Prefer declared types which are not exactly any
3166
- & Pick<P, NotExactlyAnyPropertyKeys<P>>
3167
- // For props which are exactly any, use the type inferred from propTypes if present
3168
- & Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>>
3169
- // Keep leftover props not specified in propTypes
3170
- & Pick<P, Exclude<keyof P, keyof T>>
3244
+ : string extends keyof P ? P
3245
+ // Prefer declared types which are not exactly any
3246
+ :
3247
+ & Pick<P, NotExactlyAnyPropertyKeys<P>>
3248
+ // For props which are exactly any, use the type inferred from propTypes if present
3249
+ & Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>>
3250
+ // Keep leftover props not specified in propTypes
3251
+ & Pick<P, Exclude<keyof P, keyof T>>
3171
3252
  : never;
3172
3253
 
3173
3254
  type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
@@ -3176,43 +3257,46 @@ type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined };
3176
3257
  // Undeclared default props are augmented into the resulting allowable attributes
3177
3258
  // If declared props have indexed properties, ignore default props entirely as keyof gets widened
3178
3259
  // Wrap in an outer-level conditional type to allow distribution over props that are unions
3179
- type Defaultize<P, D> = P extends any
3180
- ? string extends keyof P ? P :
3260
+ type Defaultize<P, D> = P extends any ? string extends keyof P ? P
3261
+ :
3181
3262
  & Pick<P, Exclude<keyof P, keyof D>>
3182
3263
  & InexactPartial<Pick<P, Extract<keyof P, keyof D>>>
3183
3264
  & InexactPartial<Pick<D, Exclude<keyof D, keyof P>>>
3184
3265
  : never;
3185
3266
 
3186
- type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D; }
3267
+ type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D }
3187
3268
  ? Defaultize<MergePropTypes<P, PropTypes.InferProps<T>>, D>
3188
- : C extends { propTypes: infer T; }
3189
- ? MergePropTypes<P, PropTypes.InferProps<T>>
3190
- : C extends { defaultProps: infer D; }
3191
- ? Defaultize<P, D>
3192
- : P;
3269
+ : C extends { propTypes: infer T } ? MergePropTypes<P, PropTypes.InferProps<T>>
3270
+ : C extends { defaultProps: infer D } ? Defaultize<P, D>
3271
+ : P;
3193
3272
 
3194
3273
  declare global {
3195
3274
  /**
3196
3275
  * @deprecated Use `React.JSX` instead of the global `JSX` namespace.
3197
3276
  */
3198
3277
  namespace JSX {
3199
- interface Element extends React.ReactElement<any, any> { }
3278
+ interface Element extends React.ReactElement<any, any> {}
3200
3279
  interface ElementClass extends React.Component<any> {
3201
3280
  render(): React.ReactNode;
3202
3281
  }
3203
- interface ElementAttributesProperty { props: {}; }
3204
- interface ElementChildrenAttribute { children: {}; }
3282
+ interface ElementAttributesProperty {
3283
+ props: {};
3284
+ }
3285
+ interface ElementChildrenAttribute {
3286
+ children: {};
3287
+ }
3205
3288
 
3206
3289
  // We can't recurse forever because `type` can't be self-referential;
3207
3290
  // let's assume it's reasonable to do a single React.lazy() around a single React.memo() / vice-versa
3208
- type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
3291
+ type LibraryManagedAttributes<C, P> = C extends
3292
+ React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
3209
3293
  ? T extends React.MemoExoticComponent<infer U> | React.LazyExoticComponent<infer U>
3210
3294
  ? ReactManagedAttributes<U, P>
3211
- : ReactManagedAttributes<T, P>
3295
+ : ReactManagedAttributes<T, P>
3212
3296
  : ReactManagedAttributes<C, P>;
3213
3297
 
3214
- interface IntrinsicAttributes extends React.Attributes { }
3215
- interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> { }
3298
+ interface IntrinsicAttributes extends React.Attributes {}
3299
+ interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {}
3216
3300
 
3217
3301
  interface IntrinsicElements {
3218
3302
  // HTML