@types/react 17.0.65 → 17.0.66

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 v17.0/index.d.ts CHANGED
@@ -31,9 +31,9 @@
31
31
 
32
32
  /// <reference path="global.d.ts" />
33
33
 
34
- import * as CSS from 'csstype';
35
- import * as PropTypes from 'prop-types';
36
- import { Interaction as SchedulerInteraction } from 'scheduler/tracing';
34
+ import * as CSS from "csstype";
35
+ import * as PropTypes from "prop-types";
36
+ import { Interaction as SchedulerInteraction } from "scheduler/tracing";
37
37
 
38
38
  type NativeAnimationEvent = AnimationEvent;
39
39
  type NativeClipboardEvent = ClipboardEvent;
@@ -47,8 +47,8 @@ type NativePointerEvent = PointerEvent;
47
47
  type NativeTransitionEvent = TransitionEvent;
48
48
  type NativeUIEvent = UIEvent;
49
49
  type NativeWheelEvent = WheelEvent;
50
- type Booleanish = boolean | 'true' | 'false';
51
- type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;
50
+ type Booleanish = boolean | "true" | "false";
51
+ type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined;
52
52
 
53
53
  declare const UNDEFINED_VOID_ONLY: unique symbol;
54
54
  // Destructors are only allowed to return void.
@@ -64,10 +64,10 @@ declare namespace React {
64
64
  // ----------------------------------------------------------------------
65
65
 
66
66
  type ElementType<P = any> =
67
- {
68
- [K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never
69
- }[keyof JSX.IntrinsicElements] |
70
- ComponentType<P>;
67
+ | {
68
+ [K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never;
69
+ }[keyof JSX.IntrinsicElements]
70
+ | ComponentType<P>;
71
71
  /**
72
72
  * @deprecated Please use `ElementType`
73
73
  */
@@ -76,7 +76,7 @@ declare namespace React {
76
76
 
77
77
  type JSXElementConstructor<P> =
78
78
  | ((props: P) => ReactElement<any, any> | null)
79
- | (new (props: P) => Component<any, any>);
79
+ | (new(props: P) => Component<any, any>);
80
80
 
81
81
  interface RefObject<T> {
82
82
  readonly current: T | null;
@@ -105,18 +105,16 @@ declare namespace React {
105
105
  type ElementRef<
106
106
  C extends
107
107
  | ForwardRefExoticComponent<any>
108
- | { new (props: any): Component<any> }
108
+ | { new(props: any): Component<any> }
109
109
  | ((props: any, context?: any) => ReactElement | null)
110
- | keyof JSX.IntrinsicElements
110
+ | keyof JSX.IntrinsicElements,
111
111
  > =
112
112
  // need to check first if `ref` is a valid prop for ts@3.0
113
113
  // otherwise it will infer `{}` instead of `never`
114
- "ref" extends keyof ComponentPropsWithRef<C>
115
- ? NonNullable<ComponentPropsWithRef<C>["ref"]> extends Ref<
114
+ "ref" extends keyof ComponentPropsWithRef<C> ? NonNullable<ComponentPropsWithRef<C>["ref"]> extends Ref<
116
115
  infer Instance
117
- >
118
- ? Instance
119
- : never
116
+ > ? Instance
117
+ : never
120
118
  : never;
121
119
 
122
120
  type ComponentState = any;
@@ -137,7 +135,10 @@ declare namespace React {
137
135
  ref?: LegacyRef<T> | undefined;
138
136
  }
139
137
 
140
- interface ReactElement<P = any, T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>> {
138
+ interface ReactElement<
139
+ P = any,
140
+ T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>,
141
+ > {
141
142
  type: T;
142
143
  props: P;
143
144
  key: Key | null;
@@ -145,8 +146,8 @@ declare namespace React {
145
146
 
146
147
  interface ReactComponentElement<
147
148
  T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>,
148
- P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, 'key' | 'ref'>>
149
- > extends ReactElement<P, Exclude<T, number>> { }
149
+ P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, "key" | "ref">>,
150
+ > extends ReactElement<P, Exclude<T, number>> {}
150
151
 
151
152
  /**
152
153
  * @deprecated Please use `FunctionComponentElement`
@@ -154,7 +155,7 @@ declare namespace React {
154
155
  type SFCElement<P> = FunctionComponentElement<P>;
155
156
 
156
157
  interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
157
- ref?: ('ref' extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
158
+ ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
158
159
  }
159
160
 
160
161
  type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>;
@@ -165,12 +166,14 @@ declare namespace React {
165
166
  type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
166
167
 
167
168
  // string fallback for custom web-components
168
- interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element> extends ReactElement<P, string> {
169
+ interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element>
170
+ extends ReactElement<P, string>
171
+ {
169
172
  ref: LegacyRef<T>;
170
173
  }
171
174
 
172
175
  // ReactHTML for ReactHTMLElement
173
- interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> { }
176
+ interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {}
174
177
 
175
178
  interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> {
176
179
  type: keyof ReactHTML;
@@ -197,16 +200,23 @@ declare namespace React {
197
200
  */
198
201
  type SFCFactory<P> = FunctionComponentFactory<P>;
199
202
 
200
- type FunctionComponentFactory<P> = (props?: Attributes & P, ...children: ReactNode[]) => FunctionComponentElement<P>;
203
+ type FunctionComponentFactory<P> = (
204
+ props?: Attributes & P,
205
+ ...children: ReactNode[]
206
+ ) => FunctionComponentElement<P>;
201
207
 
202
- type ComponentFactory<P, T extends Component<P, ComponentState>> =
203
- (props?: ClassAttributes<T> & P, ...children: ReactNode[]) => CElement<P, T>;
208
+ type ComponentFactory<P, T extends Component<P, ComponentState>> = (
209
+ props?: ClassAttributes<T> & P,
210
+ ...children: ReactNode[]
211
+ ) => CElement<P, T>;
204
212
 
205
213
  type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>;
206
214
  type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>;
207
215
 
208
- type DOMFactory<P extends DOMAttributes<T>, T extends Element> =
209
- (props?: ClassAttributes<T> & P | null, ...children: ReactNode[]) => DOMElement<P, T>;
216
+ type DOMFactory<P extends DOMAttributes<T>, T extends Element> = (
217
+ props?: ClassAttributes<T> & P | null,
218
+ ...children: ReactNode[]
219
+ ) => DOMElement<P, T>;
210
220
 
211
221
  interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {}
212
222
 
@@ -215,7 +225,10 @@ declare namespace React {
215
225
  }
216
226
 
217
227
  interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> {
218
- (props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null, ...children: ReactNode[]): ReactSVGElement;
228
+ (
229
+ props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null,
230
+ ...children: ReactNode[]
231
+ ): ReactSVGElement;
219
232
  }
220
233
 
221
234
  //
@@ -238,18 +251,23 @@ declare namespace React {
238
251
 
239
252
  // DOM Elements
240
253
  function createFactory<T extends HTMLElement>(
241
- type: keyof ReactHTML): HTMLFactory<T>;
254
+ type: keyof ReactHTML,
255
+ ): HTMLFactory<T>;
242
256
  function createFactory(
243
- type: keyof ReactSVG): SVGFactory;
257
+ type: keyof ReactSVG,
258
+ ): SVGFactory;
244
259
  function createFactory<P extends DOMAttributes<T>, T extends Element>(
245
- type: string): DOMFactory<P, T>;
260
+ type: string,
261
+ ): DOMFactory<P, T>;
246
262
 
247
263
  // Custom components
248
264
  function createFactory<P>(type: FunctionComponent<P>): FunctionComponentFactory<P>;
249
265
  function createFactory<P>(
250
- type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>): CFactory<P, ClassicComponent<P, ComponentState>>;
266
+ type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
267
+ ): CFactory<P, ClassicComponent<P, ComponentState>>;
251
268
  function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
252
- type: ClassType<P, T, C>): CFactory<P, T>;
269
+ type: ClassType<P, T, C>,
270
+ ): CFactory<P, T>;
253
271
  function createFactory<P>(type: ComponentClass<P>): Factory<P>;
254
272
 
255
273
  // DOM Elements
@@ -257,74 +275,89 @@ declare namespace React {
257
275
  function createElement(
258
276
  type: "input",
259
277
  props?: InputHTMLAttributes<HTMLInputElement> & ClassAttributes<HTMLInputElement> | null,
260
- ...children: ReactNode[]): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
278
+ ...children: ReactNode[]
279
+ ): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
261
280
  function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
262
281
  type: keyof ReactHTML,
263
282
  props?: ClassAttributes<T> & P | null,
264
- ...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
283
+ ...children: ReactNode[]
284
+ ): DetailedReactHTMLElement<P, T>;
265
285
  function createElement<P extends SVGAttributes<T>, T extends SVGElement>(
266
286
  type: keyof ReactSVG,
267
287
  props?: ClassAttributes<T> & P | null,
268
- ...children: ReactNode[]): ReactSVGElement;
288
+ ...children: ReactNode[]
289
+ ): ReactSVGElement;
269
290
  function createElement<P extends DOMAttributes<T>, T extends Element>(
270
291
  type: string,
271
292
  props?: ClassAttributes<T> & P | null,
272
- ...children: ReactNode[]): DOMElement<P, T>;
293
+ ...children: ReactNode[]
294
+ ): DOMElement<P, T>;
273
295
 
274
296
  // Custom components
275
297
 
276
298
  function createElement<P extends {}>(
277
299
  type: FunctionComponent<P>,
278
300
  props?: Attributes & P | null,
279
- ...children: ReactNode[]): FunctionComponentElement<P>;
301
+ ...children: ReactNode[]
302
+ ): FunctionComponentElement<P>;
280
303
  function createElement<P extends {}>(
281
304
  type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
282
305
  props?: ClassAttributes<ClassicComponent<P, ComponentState>> & P | null,
283
- ...children: ReactNode[]): CElement<P, ClassicComponent<P, ComponentState>>;
306
+ ...children: ReactNode[]
307
+ ): CElement<P, ClassicComponent<P, ComponentState>>;
284
308
  function createElement<P extends {}, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
285
309
  type: ClassType<P, T, C>,
286
310
  props?: ClassAttributes<T> & P | null,
287
- ...children: ReactNode[]): CElement<P, T>;
311
+ ...children: ReactNode[]
312
+ ): CElement<P, T>;
288
313
  function createElement<P extends {}>(
289
314
  type: FunctionComponent<P> | ComponentClass<P> | string,
290
315
  props?: Attributes & P | null,
291
- ...children: ReactNode[]): ReactElement<P>;
316
+ ...children: ReactNode[]
317
+ ): ReactElement<P>;
292
318
 
293
319
  // DOM Elements
294
320
  // ReactHTMLElement
295
321
  function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
296
322
  element: DetailedReactHTMLElement<P, T>,
297
323
  props?: P,
298
- ...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
324
+ ...children: ReactNode[]
325
+ ): DetailedReactHTMLElement<P, T>;
299
326
  // ReactHTMLElement, less specific
300
327
  function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
301
328
  element: ReactHTMLElement<T>,
302
329
  props?: P,
303
- ...children: ReactNode[]): ReactHTMLElement<T>;
330
+ ...children: ReactNode[]
331
+ ): ReactHTMLElement<T>;
304
332
  // SVGElement
305
333
  function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>(
306
334
  element: ReactSVGElement,
307
335
  props?: P,
308
- ...children: ReactNode[]): ReactSVGElement;
336
+ ...children: ReactNode[]
337
+ ): ReactSVGElement;
309
338
  // DOM Element (has to be the last, because type checking stops at first overload that fits)
310
339
  function cloneElement<P extends DOMAttributes<T>, T extends Element>(
311
340
  element: DOMElement<P, T>,
312
341
  props?: DOMAttributes<T> & P,
313
- ...children: ReactNode[]): DOMElement<P, T>;
342
+ ...children: ReactNode[]
343
+ ): DOMElement<P, T>;
314
344
 
315
345
  // Custom components
316
346
  function cloneElement<P>(
317
347
  element: FunctionComponentElement<P>,
318
348
  props?: Partial<P> & Attributes,
319
- ...children: ReactNode[]): FunctionComponentElement<P>;
349
+ ...children: ReactNode[]
350
+ ): FunctionComponentElement<P>;
320
351
  function cloneElement<P, T extends Component<P, ComponentState>>(
321
352
  element: CElement<P, T>,
322
353
  props?: Partial<P> & ClassAttributes<T>,
323
- ...children: ReactNode[]): CElement<P, T>;
354
+ ...children: ReactNode[]
355
+ ): CElement<P, T>;
324
356
  function cloneElement<P>(
325
357
  element: ReactElement<P>,
326
358
  props?: Partial<P> & Attributes,
327
- ...children: ReactNode[]): ReactElement<P>;
359
+ ...children: ReactNode[]
360
+ ): ReactElement<P>;
328
361
 
329
362
  // Context via RenderProps
330
363
  interface ProviderProps<T> {
@@ -350,7 +383,7 @@ declare namespace React {
350
383
  /**
351
384
  * **NOTE**: Exotic components are not callable.
352
385
  */
353
- (props: P): (ReactElement|null);
386
+ (props: P): ReactElement | null;
354
387
  readonly $$typeof: symbol;
355
388
  }
356
389
 
@@ -390,7 +423,7 @@ declare namespace React {
390
423
 
391
424
  // TODO(react18): `fallback?: ReactNode;`
392
425
  /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */
393
- fallback: NonNullable<ReactNode>|null;
426
+ fallback: NonNullable<ReactNode> | null;
394
427
  }
395
428
 
396
429
  // TODO(react18): Updated JSDoc to reflect that Suspense works on the server.
@@ -428,7 +461,7 @@ declare namespace React {
428
461
  type ReactInstance = Component<any> | Element;
429
462
 
430
463
  // Base component for plain JS classes
431
- interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> { }
464
+ interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {}
432
465
  class Component<P, S> {
433
466
  // tslint won't let me format the sample code in a way that vscode likes it :(
434
467
  /**
@@ -482,8 +515,8 @@ declare namespace React {
482
515
  // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
483
516
  // Also, the ` | S` allows intellisense to not be dumbisense
484
517
  setState<K extends keyof S>(
485
- state: ((prevState: Readonly<S>, props: Readonly<P>) => (Pick<S, K> | S | null)) | (Pick<S, K> | S | null),
486
- callback?: () => void
518
+ state: ((prevState: Readonly<S>, props: Readonly<P>) => Pick<S, K> | S | null) | (Pick<S, K> | S | null),
519
+ callback?: () => void,
487
520
  ): void;
488
521
 
489
522
  forceUpdate(callback?: () => void): void;
@@ -501,11 +534,11 @@ declare namespace React {
501
534
  * https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs
502
535
  */
503
536
  refs: {
504
- [key: string]: ReactInstance
537
+ [key: string]: ReactInstance;
505
538
  };
506
539
  }
507
540
 
508
- class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> { }
541
+ class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {}
509
542
 
510
543
  interface ClassicComponent<P = {}, S = {}> extends Component<P, S> {
511
544
  replaceState(nextState: S, callback?: () => void): void;
@@ -578,10 +611,10 @@ declare namespace React {
578
611
  * @deprecated Use ForwardRefRenderFunction. forwardRef doesn't accept a
579
612
  * "real" component.
580
613
  */
581
- interface RefForwardingComponent <T, P = {}> extends ForwardRefRenderFunction<T, P> {}
614
+ interface RefForwardingComponent<T, P = {}> extends ForwardRefRenderFunction<T, P> {}
582
615
 
583
616
  interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
584
- new (props: P, context?: any): Component<P, S>;
617
+ new(props: P, context?: any): Component<P, S>;
585
618
  propTypes?: WeakValidationMap<P> | undefined;
586
619
  contextType?: Context<any> | undefined;
587
620
  contextTypes?: ValidationMap<any> | undefined;
@@ -591,7 +624,7 @@ declare namespace React {
591
624
  }
592
625
 
593
626
  interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
594
- new (props: P, context?: any): ClassicComponent<P, ComponentState>;
627
+ new(props: P, context?: any): ClassicComponent<P, ComponentState>;
595
628
  getDefaultProps?(): P;
596
629
  }
597
630
 
@@ -601,8 +634,8 @@ declare namespace React {
601
634
  * See https://github.com/Microsoft/TypeScript/issues/7234 for more info.
602
635
  */
603
636
  type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
604
- C &
605
- (new (props: P, context?: any) => T);
637
+ & C
638
+ & (new(props: P, context?: any) => T);
606
639
 
607
640
  //
608
641
  // Component Specs and Lifecycle
@@ -800,23 +833,24 @@ declare namespace React {
800
833
  propTypes?: WeakValidationMap<P> | undefined;
801
834
  }
802
835
 
803
- function forwardRef<T, P = {}>(render: ForwardRefRenderFunction<T, P>): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
836
+ function forwardRef<T, P = {}>(
837
+ render: ForwardRefRenderFunction<T, P>,
838
+ ): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
804
839
 
805
840
  /** Ensures that the props do not include ref at all */
806
841
  type PropsWithoutRef<P> =
807
842
  // Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions.
808
843
  // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
809
844
  // https://github.com/Microsoft/TypeScript/issues/28339
810
- P extends any ? ('ref' extends keyof P ? Omit<P, 'ref'> : P) : P;
845
+ P extends any ? ("ref" extends keyof P ? Omit<P, "ref"> : P) : P;
811
846
  /** Ensures that the props do not include string ref, which cannot be forwarded */
812
847
  type PropsWithRef<P> =
813
848
  // Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}.
814
- 'ref' extends keyof P
849
+ "ref" extends keyof P
815
850
  ? P extends { ref?: infer R | undefined }
816
- ? string extends R
817
- ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
818
- : P
851
+ ? string extends R ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined }
819
852
  : P
853
+ : P
820
854
  : P;
821
855
 
822
856
  type PropsWithChildren<P> = P & { children?: ReactNode | undefined };
@@ -825,26 +859,20 @@ declare namespace React {
825
859
  * NOTE: prefer ComponentPropsWithRef, if the ref is forwarded,
826
860
  * or ComponentPropsWithoutRef when refs are not supported.
827
861
  */
828
- type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> =
829
- T extends JSXElementConstructor<infer P>
830
- ? P
831
- : T extends keyof JSX.IntrinsicElements
832
- ? JSX.IntrinsicElements[T]
833
- : {};
834
- type ComponentPropsWithRef<T extends ElementType> =
835
- T extends (new (props: infer P) => Component<any, any>)
836
- ? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
837
- : PropsWithRef<ComponentProps<T>>;
838
- type ComponentPropsWithoutRef<T extends ElementType> =
839
- PropsWithoutRef<ComponentProps<T>>;
862
+ type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends
863
+ JSXElementConstructor<infer P> ? P
864
+ : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T]
865
+ : {};
866
+ type ComponentPropsWithRef<T extends ElementType> = T extends (new(props: infer P) => Component<any, any>)
867
+ ? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
868
+ : PropsWithRef<ComponentProps<T>>;
869
+ type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;
840
870
 
841
871
  type ComponentRef<T extends ElementType> = T extends NamedExoticComponent<
842
872
  ComponentPropsWithoutRef<T> & RefAttributes<infer Method>
843
- >
844
- ? Method
845
- : ComponentPropsWithRef<T> extends RefAttributes<infer Method>
846
- ? Method
847
- : never;
873
+ > ? Method
874
+ : ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
875
+ : never;
848
876
 
849
877
  // will show `Memo(${Component.displayName || Component.name})` in devtools by default,
850
878
  // but can be given its own specific name
@@ -854,11 +882,14 @@ declare namespace React {
854
882
 
855
883
  function memo<P extends object>(
856
884
  Component: FunctionComponent<P>,
857
- propsAreEqual?: (prevProps: Readonly<PropsWithChildren<P>>, nextProps: Readonly<PropsWithChildren<P>>) => boolean
885
+ propsAreEqual?: (
886
+ prevProps: Readonly<PropsWithChildren<P>>,
887
+ nextProps: Readonly<PropsWithChildren<P>>,
888
+ ) => boolean,
858
889
  ): NamedExoticComponent<P>;
859
890
  function memo<T extends ComponentType<any>>(
860
891
  Component: T,
861
- propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean
892
+ propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean,
862
893
  ): MemoExoticComponent<T>;
863
894
 
864
895
  type LazyExoticComponent<T extends ComponentType<any>> = ExoticComponent<ComponentPropsWithRef<T>> & {
@@ -866,7 +897,7 @@ declare namespace React {
866
897
  };
867
898
 
868
899
  function lazy<T extends ComponentType<any>>(
869
- factory: () => Promise<{ default: T }>
900
+ factory: () => Promise<{ default: T }>,
870
901
  ): LazyExoticComponent<T>;
871
902
 
872
903
  //
@@ -891,13 +922,13 @@ declare namespace React {
891
922
  type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
892
923
  type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never;
893
924
  // The identity check is done with the SameValue algorithm (Object.is), which is stricter than ===
894
- type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> =
895
- R extends ReducerWithoutAction<infer S> ? S : never;
925
+ type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> = R extends ReducerWithoutAction<infer S> ? S
926
+ : never;
896
927
  // TODO (TypeScript 3.0): ReadonlyArray<unknown>
897
928
  type DependencyList = ReadonlyArray<any>;
898
929
 
899
930
  // NOTE: callbacks are _only_ allowed to return either void, or a destructor.
900
- type EffectCallback = () => (void | Destructor);
931
+ type EffectCallback = () => void | Destructor;
901
932
 
902
933
  interface MutableRefObject<T> {
903
934
  current: T;
@@ -911,7 +942,7 @@ declare namespace React {
911
942
  * @version 16.8.0
912
943
  * @see https://react.dev/reference/react/useContext
913
944
  */
914
- function useContext<T>(context: Context<T>/*, (not public API) observedBits?: number|boolean */): T;
945
+ function useContext<T>(context: Context<T> /*, (not public API) observedBits?: number|boolean */): T;
915
946
  /**
916
947
  * Returns a stateful value, and a function to update it.
917
948
  *
@@ -941,7 +972,7 @@ declare namespace React {
941
972
  function useReducer<R extends ReducerWithoutAction<any>, I>(
942
973
  reducer: R,
943
974
  initializerArg: I,
944
- initializer: (arg: I) => ReducerStateWithoutAction<R>
975
+ initializer: (arg: I) => ReducerStateWithoutAction<R>,
945
976
  ): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
946
977
  /**
947
978
  * An alternative to `useState`.
@@ -957,7 +988,7 @@ declare namespace React {
957
988
  function useReducer<R extends ReducerWithoutAction<any>>(
958
989
  reducer: R,
959
990
  initializerArg: ReducerStateWithoutAction<R>,
960
- initializer?: undefined
991
+ initializer?: undefined,
961
992
  ): [ReducerStateWithoutAction<R>, DispatchWithoutAction];
962
993
  /**
963
994
  * An alternative to `useState`.
@@ -975,7 +1006,7 @@ declare namespace React {
975
1006
  function useReducer<R extends Reducer<any, any>, I>(
976
1007
  reducer: R,
977
1008
  initializerArg: I & ReducerState<R>,
978
- initializer: (arg: I & ReducerState<R>) => ReducerState<R>
1009
+ initializer: (arg: I & ReducerState<R>) => ReducerState<R>,
979
1010
  ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
980
1011
  /**
981
1012
  * An alternative to `useState`.
@@ -991,7 +1022,7 @@ declare namespace React {
991
1022
  function useReducer<R extends Reducer<any, any>, I>(
992
1023
  reducer: R,
993
1024
  initializerArg: I,
994
- initializer: (arg: I) => ReducerState<R>
1025
+ initializer: (arg: I) => ReducerState<R>,
995
1026
  ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
996
1027
  /**
997
1028
  * An alternative to `useState`.
@@ -1016,7 +1047,7 @@ declare namespace React {
1016
1047
  function useReducer<R extends Reducer<any, any>>(
1017
1048
  reducer: R,
1018
1049
  initialState: ReducerState<R>,
1019
- initializer?: undefined
1050
+ initializer?: undefined,
1020
1051
  ): [ReducerState<R>, Dispatch<ReducerAction<R>>];
1021
1052
  /**
1022
1053
  * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
@@ -1043,7 +1074,7 @@ declare namespace React {
1043
1074
  * @version 16.8.0
1044
1075
  * @see https://react.dev/reference/react/useRef
1045
1076
  */
1046
- function useRef<T>(initialValue: T|null): RefObject<T>;
1077
+ function useRef<T>(initialValue: T | null): RefObject<T>;
1047
1078
  // convenience overload for potentially undefined initialValue / call with 0 arguments
1048
1079
  // has a default to stop it from defaulting to {} instead
1049
1080
  /**
@@ -1091,7 +1122,7 @@ declare namespace React {
1091
1122
  * @version 16.8.0
1092
1123
  * @see https://react.dev/reference/react/useImperativeHandle
1093
1124
  */
1094
- function useImperativeHandle<T, R extends T>(ref: Ref<T>|undefined, init: () => R, deps?: DependencyList): void;
1125
+ function useImperativeHandle<T, R extends T>(ref: Ref<T> | undefined, init: () => R, deps?: DependencyList): void;
1095
1126
  // I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key
1096
1127
  // useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y.
1097
1128
  /**
@@ -1176,7 +1207,7 @@ declare namespace React {
1176
1207
  twist: number;
1177
1208
  width: number;
1178
1209
  height: number;
1179
- pointerType: 'mouse' | 'pen' | 'touch';
1210
+ pointerType: "mouse" | "pen" | "touch";
1180
1211
  isPrimary: boolean;
1181
1212
  }
1182
1213
 
@@ -1196,7 +1227,21 @@ declare namespace React {
1196
1227
  target: EventTarget & T;
1197
1228
  }
1198
1229
 
1199
- export type ModifierKey = "Alt" | "AltGraph" | "CapsLock" | "Control" | "Fn" | "FnLock" | "Hyper" | "Meta" | "NumLock" | "ScrollLock" | "Shift" | "Super" | "Symbol" | "SymbolLock";
1230
+ export type ModifierKey =
1231
+ | "Alt"
1232
+ | "AltGraph"
1233
+ | "CapsLock"
1234
+ | "Control"
1235
+ | "Fn"
1236
+ | "FnLock"
1237
+ | "Hyper"
1238
+ | "Meta"
1239
+ | "NumLock"
1240
+ | "ScrollLock"
1241
+ | "Shift"
1242
+ | "Super"
1243
+ | "Symbol"
1244
+ | "SymbolLock";
1200
1245
 
1201
1246
  interface KeyboardEvent<T = Element> extends UIEvent<T, NativeKeyboardEvent> {
1202
1247
  altKey: boolean;
@@ -1556,262 +1601,273 @@ declare namespace React {
1556
1601
  // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/
1557
1602
  interface AriaAttributes {
1558
1603
  /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */
1559
- 'aria-activedescendant'?: string | undefined;
1604
+ "aria-activedescendant"?: string | undefined;
1560
1605
  /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */
1561
- 'aria-atomic'?: Booleanish | undefined;
1606
+ "aria-atomic"?: Booleanish | undefined;
1562
1607
  /**
1563
1608
  * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be
1564
1609
  * presented if they are made.
1565
1610
  */
1566
- 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both' | undefined;
1611
+ "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
1567
1612
  /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */
1568
- 'aria-busy'?: Booleanish | undefined;
1613
+ "aria-busy"?: Booleanish | undefined;
1569
1614
  /**
1570
1615
  * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
1571
1616
  * @see aria-pressed @see aria-selected.
1572
1617
  */
1573
- 'aria-checked'?: boolean | 'false' | 'mixed' | 'true' | undefined;
1618
+ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
1574
1619
  /**
1575
1620
  * Defines the total number of columns in a table, grid, or treegrid.
1576
1621
  * @see aria-colindex.
1577
1622
  */
1578
- 'aria-colcount'?: number | undefined;
1623
+ "aria-colcount"?: number | undefined;
1579
1624
  /**
1580
1625
  * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
1581
1626
  * @see aria-colcount @see aria-colspan.
1582
1627
  */
1583
- 'aria-colindex'?: number | undefined;
1628
+ "aria-colindex"?: number | undefined;
1584
1629
  /**
1585
1630
  * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
1586
1631
  * @see aria-colindex @see aria-rowspan.
1587
1632
  */
1588
- 'aria-colspan'?: number | undefined;
1633
+ "aria-colspan"?: number | undefined;
1589
1634
  /**
1590
1635
  * Identifies the element (or elements) whose contents or presence are controlled by the current element.
1591
1636
  * @see aria-owns.
1592
1637
  */
1593
- 'aria-controls'?: string | undefined;
1638
+ "aria-controls"?: string | undefined;
1594
1639
  /** Indicates the element that represents the current item within a container or set of related elements. */
1595
- 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time' | undefined;
1640
+ "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined;
1596
1641
  /**
1597
1642
  * Identifies the element (or elements) that describes the object.
1598
1643
  * @see aria-labelledby
1599
1644
  */
1600
- 'aria-describedby'?: string | undefined;
1645
+ "aria-describedby"?: string | undefined;
1601
1646
  /**
1602
1647
  * Identifies the element that provides a detailed, extended description for the object.
1603
1648
  * @see aria-describedby.
1604
1649
  */
1605
- 'aria-details'?: string | undefined;
1650
+ "aria-details"?: string | undefined;
1606
1651
  /**
1607
1652
  * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
1608
1653
  * @see aria-hidden @see aria-readonly.
1609
1654
  */
1610
- 'aria-disabled'?: Booleanish | undefined;
1655
+ "aria-disabled"?: Booleanish | undefined;
1611
1656
  /**
1612
1657
  * Indicates what functions can be performed when a dragged object is released on the drop target.
1613
1658
  * @deprecated in ARIA 1.1
1614
1659
  */
1615
- 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup' | undefined;
1660
+ "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
1616
1661
  /**
1617
1662
  * Identifies the element that provides an error message for the object.
1618
1663
  * @see aria-invalid @see aria-describedby.
1619
1664
  */
1620
- 'aria-errormessage'?: string | undefined;
1665
+ "aria-errormessage"?: string | undefined;
1621
1666
  /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */
1622
- 'aria-expanded'?: Booleanish | undefined;
1667
+ "aria-expanded"?: Booleanish | undefined;
1623
1668
  /**
1624
1669
  * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,
1625
1670
  * allows assistive technology to override the general default of reading in document source order.
1626
1671
  */
1627
- 'aria-flowto'?: string | undefined;
1672
+ "aria-flowto"?: string | undefined;
1628
1673
  /**
1629
1674
  * Indicates an element's "grabbed" state in a drag-and-drop operation.
1630
1675
  * @deprecated in ARIA 1.1
1631
1676
  */
1632
- 'aria-grabbed'?: Booleanish | undefined;
1677
+ "aria-grabbed"?: Booleanish | undefined;
1633
1678
  /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */
1634
- 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | undefined;
1679
+ "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
1635
1680
  /**
1636
1681
  * Indicates whether the element is exposed to an accessibility API.
1637
1682
  * @see aria-disabled.
1638
1683
  */
1639
- 'aria-hidden'?: Booleanish | undefined;
1684
+ "aria-hidden"?: Booleanish | undefined;
1640
1685
  /**
1641
1686
  * Indicates the entered value does not conform to the format expected by the application.
1642
1687
  * @see aria-errormessage.
1643
1688
  */
1644
- 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling' | undefined;
1689
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
1645
1690
  /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */
1646
- 'aria-keyshortcuts'?: string | undefined;
1691
+ "aria-keyshortcuts"?: string | undefined;
1647
1692
  /**
1648
1693
  * Defines a string value that labels the current element.
1649
1694
  * @see aria-labelledby.
1650
1695
  */
1651
- 'aria-label'?: string | undefined;
1696
+ "aria-label"?: string | undefined;
1652
1697
  /**
1653
1698
  * Identifies the element (or elements) that labels the current element.
1654
1699
  * @see aria-describedby.
1655
1700
  */
1656
- 'aria-labelledby'?: string | undefined;
1701
+ "aria-labelledby"?: string | undefined;
1657
1702
  /** Defines the hierarchical level of an element within a structure. */
1658
- 'aria-level'?: number | undefined;
1703
+ "aria-level"?: number | undefined;
1659
1704
  /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */
1660
- 'aria-live'?: 'off' | 'assertive' | 'polite' | undefined;
1705
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
1661
1706
  /** Indicates whether an element is modal when displayed. */
1662
- 'aria-modal'?: Booleanish | undefined;
1707
+ "aria-modal"?: Booleanish | undefined;
1663
1708
  /** Indicates whether a text box accepts multiple lines of input or only a single line. */
1664
- 'aria-multiline'?: Booleanish | undefined;
1709
+ "aria-multiline"?: Booleanish | undefined;
1665
1710
  /** Indicates that the user may select more than one item from the current selectable descendants. */
1666
- 'aria-multiselectable'?: Booleanish | undefined;
1711
+ "aria-multiselectable"?: Booleanish | undefined;
1667
1712
  /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */
1668
- 'aria-orientation'?: 'horizontal' | 'vertical' | undefined;
1713
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
1669
1714
  /**
1670
1715
  * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship
1671
1716
  * between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
1672
1717
  * @see aria-controls.
1673
1718
  */
1674
- 'aria-owns'?: string | undefined;
1719
+ "aria-owns"?: string | undefined;
1675
1720
  /**
1676
1721
  * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.
1677
1722
  * A hint could be a sample value or a brief description of the expected format.
1678
1723
  */
1679
- 'aria-placeholder'?: string | undefined;
1724
+ "aria-placeholder"?: string | undefined;
1680
1725
  /**
1681
1726
  * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
1682
1727
  * @see aria-setsize.
1683
1728
  */
1684
- 'aria-posinset'?: number | undefined;
1729
+ "aria-posinset"?: number | undefined;
1685
1730
  /**
1686
1731
  * Indicates the current "pressed" state of toggle buttons.
1687
1732
  * @see aria-checked @see aria-selected.
1688
1733
  */
1689
- 'aria-pressed'?: boolean | 'false' | 'mixed' | 'true' | undefined;
1734
+ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
1690
1735
  /**
1691
1736
  * Indicates that the element is not editable, but is otherwise operable.
1692
1737
  * @see aria-disabled.
1693
1738
  */
1694
- 'aria-readonly'?: Booleanish | undefined;
1739
+ "aria-readonly"?: Booleanish | undefined;
1695
1740
  /**
1696
1741
  * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
1697
1742
  * @see aria-atomic.
1698
1743
  */
1699
- 'aria-relevant'?: 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' | undefined;
1744
+ "aria-relevant"?:
1745
+ | "additions"
1746
+ | "additions removals"
1747
+ | "additions text"
1748
+ | "all"
1749
+ | "removals"
1750
+ | "removals additions"
1751
+ | "removals text"
1752
+ | "text"
1753
+ | "text additions"
1754
+ | "text removals"
1755
+ | undefined;
1700
1756
  /** Indicates that user input is required on the element before a form may be submitted. */
1701
- 'aria-required'?: Booleanish | undefined;
1757
+ "aria-required"?: Booleanish | undefined;
1702
1758
  /** Defines a human-readable, author-localized description for the role of an element. */
1703
- 'aria-roledescription'?: string | undefined;
1759
+ "aria-roledescription"?: string | undefined;
1704
1760
  /**
1705
1761
  * Defines the total number of rows in a table, grid, or treegrid.
1706
1762
  * @see aria-rowindex.
1707
1763
  */
1708
- 'aria-rowcount'?: number | undefined;
1764
+ "aria-rowcount"?: number | undefined;
1709
1765
  /**
1710
1766
  * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
1711
1767
  * @see aria-rowcount @see aria-rowspan.
1712
1768
  */
1713
- 'aria-rowindex'?: number | undefined;
1769
+ "aria-rowindex"?: number | undefined;
1714
1770
  /**
1715
1771
  * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
1716
1772
  * @see aria-rowindex @see aria-colspan.
1717
1773
  */
1718
- 'aria-rowspan'?: number | undefined;
1774
+ "aria-rowspan"?: number | undefined;
1719
1775
  /**
1720
1776
  * Indicates the current "selected" state of various widgets.
1721
1777
  * @see aria-checked @see aria-pressed.
1722
1778
  */
1723
- 'aria-selected'?: Booleanish | undefined;
1779
+ "aria-selected"?: Booleanish | undefined;
1724
1780
  /**
1725
1781
  * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
1726
1782
  * @see aria-posinset.
1727
1783
  */
1728
- 'aria-setsize'?: number | undefined;
1784
+ "aria-setsize"?: number | undefined;
1729
1785
  /** Indicates if items in a table or grid are sorted in ascending or descending order. */
1730
- 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' | undefined;
1786
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
1731
1787
  /** Defines the maximum allowed value for a range widget. */
1732
- 'aria-valuemax'?: number | undefined;
1788
+ "aria-valuemax"?: number | undefined;
1733
1789
  /** Defines the minimum allowed value for a range widget. */
1734
- 'aria-valuemin'?: number | undefined;
1790
+ "aria-valuemin"?: number | undefined;
1735
1791
  /**
1736
1792
  * Defines the current value for a range widget.
1737
1793
  * @see aria-valuetext.
1738
1794
  */
1739
- 'aria-valuenow'?: number | undefined;
1795
+ "aria-valuenow"?: number | undefined;
1740
1796
  /** Defines the human readable text alternative of aria-valuenow for a range widget. */
1741
- 'aria-valuetext'?: string | undefined;
1797
+ "aria-valuetext"?: string | undefined;
1742
1798
  }
1743
1799
 
1744
1800
  // All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions
1745
1801
  type AriaRole =
1746
- | 'alert'
1747
- | 'alertdialog'
1748
- | 'application'
1749
- | 'article'
1750
- | 'banner'
1751
- | 'button'
1752
- | 'cell'
1753
- | 'checkbox'
1754
- | 'columnheader'
1755
- | 'combobox'
1756
- | 'complementary'
1757
- | 'contentinfo'
1758
- | 'definition'
1759
- | 'dialog'
1760
- | 'directory'
1761
- | 'document'
1762
- | 'feed'
1763
- | 'figure'
1764
- | 'form'
1765
- | 'grid'
1766
- | 'gridcell'
1767
- | 'group'
1768
- | 'heading'
1769
- | 'img'
1770
- | 'link'
1771
- | 'list'
1772
- | 'listbox'
1773
- | 'listitem'
1774
- | 'log'
1775
- | 'main'
1776
- | 'marquee'
1777
- | 'math'
1778
- | 'menu'
1779
- | 'menubar'
1780
- | 'menuitem'
1781
- | 'menuitemcheckbox'
1782
- | 'menuitemradio'
1783
- | 'navigation'
1784
- | 'none'
1785
- | 'note'
1786
- | 'option'
1787
- | 'presentation'
1788
- | 'progressbar'
1789
- | 'radio'
1790
- | 'radiogroup'
1791
- | 'region'
1792
- | 'row'
1793
- | 'rowgroup'
1794
- | 'rowheader'
1795
- | 'scrollbar'
1796
- | 'search'
1797
- | 'searchbox'
1798
- | 'separator'
1799
- | 'slider'
1800
- | 'spinbutton'
1801
- | 'status'
1802
- | 'switch'
1803
- | 'tab'
1804
- | 'table'
1805
- | 'tablist'
1806
- | 'tabpanel'
1807
- | 'term'
1808
- | 'textbox'
1809
- | 'timer'
1810
- | 'toolbar'
1811
- | 'tooltip'
1812
- | 'tree'
1813
- | 'treegrid'
1814
- | 'treeitem'
1802
+ | "alert"
1803
+ | "alertdialog"
1804
+ | "application"
1805
+ | "article"
1806
+ | "banner"
1807
+ | "button"
1808
+ | "cell"
1809
+ | "checkbox"
1810
+ | "columnheader"
1811
+ | "combobox"
1812
+ | "complementary"
1813
+ | "contentinfo"
1814
+ | "definition"
1815
+ | "dialog"
1816
+ | "directory"
1817
+ | "document"
1818
+ | "feed"
1819
+ | "figure"
1820
+ | "form"
1821
+ | "grid"
1822
+ | "gridcell"
1823
+ | "group"
1824
+ | "heading"
1825
+ | "img"
1826
+ | "link"
1827
+ | "list"
1828
+ | "listbox"
1829
+ | "listitem"
1830
+ | "log"
1831
+ | "main"
1832
+ | "marquee"
1833
+ | "math"
1834
+ | "menu"
1835
+ | "menubar"
1836
+ | "menuitem"
1837
+ | "menuitemcheckbox"
1838
+ | "menuitemradio"
1839
+ | "navigation"
1840
+ | "none"
1841
+ | "note"
1842
+ | "option"
1843
+ | "presentation"
1844
+ | "progressbar"
1845
+ | "radio"
1846
+ | "radiogroup"
1847
+ | "region"
1848
+ | "row"
1849
+ | "rowgroup"
1850
+ | "rowheader"
1851
+ | "scrollbar"
1852
+ | "search"
1853
+ | "searchbox"
1854
+ | "separator"
1855
+ | "slider"
1856
+ | "spinbutton"
1857
+ | "status"
1858
+ | "switch"
1859
+ | "tab"
1860
+ | "table"
1861
+ | "tablist"
1862
+ | "tabpanel"
1863
+ | "term"
1864
+ | "textbox"
1865
+ | "timer"
1866
+ | "toolbar"
1867
+ | "tooltip"
1868
+ | "tree"
1869
+ | "treegrid"
1870
+ | "treeitem"
1815
1871
  | (string & {});
1816
1872
 
1817
1873
  interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
@@ -1839,7 +1895,7 @@ declare namespace React {
1839
1895
  style?: CSSProperties | undefined;
1840
1896
  tabIndex?: number | undefined;
1841
1897
  title?: string | undefined;
1842
- translate?: 'yes' | 'no' | undefined;
1898
+ translate?: "yes" | "no" | undefined;
1843
1899
 
1844
1900
  // Unknown
1845
1901
  radioGroup?: string | undefined; // <command>, <menuitem>
@@ -1872,14 +1928,14 @@ declare namespace React {
1872
1928
  itemRef?: string | undefined;
1873
1929
  results?: number | undefined;
1874
1930
  security?: string | undefined;
1875
- unselectable?: 'on' | 'off' | undefined;
1931
+ unselectable?: "on" | "off" | undefined;
1876
1932
 
1877
1933
  // Living Standard
1878
1934
  /**
1879
1935
  * Hints at the type of data that might be entered by the user while editing the element or its contents
1880
1936
  * @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute
1881
1937
  */
1882
- inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' | undefined;
1938
+ inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
1883
1939
  /**
1884
1940
  * Specify that a standard HTML element should behave like a defined custom built-in element
1885
1941
  * @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is
@@ -1899,7 +1955,7 @@ declare namespace React {
1899
1955
  async?: boolean | undefined;
1900
1956
  autoComplete?: string | undefined;
1901
1957
  autoPlay?: boolean | undefined;
1902
- capture?: boolean | 'user' | 'environment' | undefined;
1958
+ capture?: boolean | "user" | "environment" | undefined;
1903
1959
  cellPadding?: number | string | undefined;
1904
1960
  cellSpacing?: number | string | undefined;
1905
1961
  charSet?: string | undefined;
@@ -1994,21 +2050,21 @@ declare namespace React {
1994
2050
  }
1995
2051
 
1996
2052
  type HTMLAttributeReferrerPolicy =
1997
- | ''
1998
- | 'no-referrer'
1999
- | 'no-referrer-when-downgrade'
2000
- | 'origin'
2001
- | 'origin-when-cross-origin'
2002
- | 'same-origin'
2003
- | 'strict-origin'
2004
- | 'strict-origin-when-cross-origin'
2005
- | 'unsafe-url';
2053
+ | ""
2054
+ | "no-referrer"
2055
+ | "no-referrer-when-downgrade"
2056
+ | "origin"
2057
+ | "origin-when-cross-origin"
2058
+ | "same-origin"
2059
+ | "strict-origin"
2060
+ | "strict-origin-when-cross-origin"
2061
+ | "unsafe-url";
2006
2062
 
2007
2063
  type HTMLAttributeAnchorTarget =
2008
- | '_self'
2009
- | '_blank'
2010
- | '_parent'
2011
- | '_top'
2064
+ | "_self"
2065
+ | "_blank"
2066
+ | "_parent"
2067
+ | "_top"
2012
2068
  | (string & {});
2013
2069
 
2014
2070
  interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -2054,7 +2110,7 @@ declare namespace React {
2054
2110
  formNoValidate?: boolean | undefined;
2055
2111
  formTarget?: string | undefined;
2056
2112
  name?: string | undefined;
2057
- type?: 'submit' | 'reset' | 'button' | undefined;
2113
+ type?: "submit" | "reset" | "button" | undefined;
2058
2114
  value?: string | ReadonlyArray<string> | number | undefined;
2059
2115
  }
2060
2116
 
@@ -2087,8 +2143,8 @@ declare namespace React {
2087
2143
  }
2088
2144
 
2089
2145
  interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
2090
- onCancel?: ReactEventHandler<T> | undefined;
2091
- onClose?: ReactEventHandler<T> | undefined;
2146
+ onCancel?: ReactEventHandler<T> | undefined;
2147
+ onClose?: ReactEventHandler<T> | undefined;
2092
2148
  open?: boolean | undefined;
2093
2149
  }
2094
2150
 
@@ -2163,38 +2219,38 @@ declare namespace React {
2163
2219
  }
2164
2220
 
2165
2221
  type HTMLInputTypeAttribute =
2166
- | 'button'
2167
- | 'checkbox'
2168
- | 'color'
2169
- | 'date'
2170
- | 'datetime-local'
2171
- | 'email'
2172
- | 'file'
2173
- | 'hidden'
2174
- | 'image'
2175
- | 'month'
2176
- | 'number'
2177
- | 'password'
2178
- | 'radio'
2179
- | 'range'
2180
- | 'reset'
2181
- | 'search'
2182
- | 'submit'
2183
- | 'tel'
2184
- | 'text'
2185
- | 'time'
2186
- | 'url'
2187
- | 'week'
2222
+ | "button"
2223
+ | "checkbox"
2224
+ | "color"
2225
+ | "date"
2226
+ | "datetime-local"
2227
+ | "email"
2228
+ | "file"
2229
+ | "hidden"
2230
+ | "image"
2231
+ | "month"
2232
+ | "number"
2233
+ | "password"
2234
+ | "radio"
2235
+ | "range"
2236
+ | "reset"
2237
+ | "search"
2238
+ | "submit"
2239
+ | "tel"
2240
+ | "text"
2241
+ | "time"
2242
+ | "url"
2243
+ | "week"
2188
2244
  | (string & {});
2189
2245
 
2190
2246
  interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
2191
2247
  accept?: string | undefined;
2192
2248
  alt?: string | undefined;
2193
2249
  autoComplete?: string | undefined;
2194
- capture?: boolean | 'user' | 'environment' | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
2250
+ capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
2195
2251
  checked?: boolean | undefined;
2196
2252
  disabled?: boolean | undefined;
2197
- enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined;
2253
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
2198
2254
  form?: string | undefined;
2199
2255
  formAction?: string | undefined;
2200
2256
  formEncType?: string | undefined;
@@ -2313,7 +2369,7 @@ declare namespace React {
2313
2369
  interface OlHTMLAttributes<T> extends HTMLAttributes<T> {
2314
2370
  reversed?: boolean | undefined;
2315
2371
  start?: number | undefined;
2316
- type?: '1' | 'a' | 'A' | 'i' | 'I' | undefined;
2372
+ type?: "1" | "a" | "A" | "i" | "I" | undefined;
2317
2373
  }
2318
2374
 
2319
2375
  interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -2492,8 +2548,21 @@ declare namespace React {
2492
2548
  accentHeight?: number | string | undefined;
2493
2549
  accumulate?: "none" | "sum" | undefined;
2494
2550
  additive?: "replace" | "sum" | undefined;
2495
- alignmentBaseline?: "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" |
2496
- "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" | undefined;
2551
+ alignmentBaseline?:
2552
+ | "auto"
2553
+ | "baseline"
2554
+ | "before-edge"
2555
+ | "text-before-edge"
2556
+ | "middle"
2557
+ | "central"
2558
+ | "after-edge"
2559
+ | "text-after-edge"
2560
+ | "ideographic"
2561
+ | "alphabetic"
2562
+ | "hanging"
2563
+ | "mathematical"
2564
+ | "inherit"
2565
+ | undefined;
2497
2566
  allowReorder?: "no" | "yes" | undefined;
2498
2567
  alphabetic?: number | string | undefined;
2499
2568
  amplitude?: number | string | undefined;
@@ -2934,7 +3003,7 @@ declare namespace React {
2934
3003
  view: SVGFactory;
2935
3004
  }
2936
3005
 
2937
- interface ReactDOM extends ReactHTML, ReactSVG { }
3006
+ interface ReactDOM extends ReactHTML, ReactSVG {}
2938
3007
 
2939
3008
  //
2940
3009
  // React.PropTypes
@@ -2947,11 +3016,9 @@ declare namespace React {
2947
3016
  type ValidationMap<T> = PropTypes.ValidationMap<T>;
2948
3017
 
2949
3018
  type WeakValidationMap<T> = {
2950
- [K in keyof T]?: null extends T[K]
2951
- ? Validator<T[K] | null | undefined>
2952
- : undefined extends T[K]
2953
- ? Validator<T[K] | null | undefined>
2954
- : Validator<T[K]>
3019
+ [K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined>
3020
+ : undefined extends T[K] ? Validator<T[K] | null | undefined>
3021
+ : Validator<T[K]>;
2955
3022
  };
2956
3023
 
2957
3024
  interface ReactPropTypes {
@@ -2978,8 +3045,10 @@ declare namespace React {
2978
3045
  // ----------------------------------------------------------------------
2979
3046
 
2980
3047
  interface ReactChildren {
2981
- map<T, C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => T):
2982
- C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
3048
+ map<T, C>(
3049
+ children: C | ReadonlyArray<C>,
3050
+ fn: (child: C, index: number) => T,
3051
+ ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
2983
3052
  forEach<C>(children: C | ReadonlyArray<C>, fn: (child: C, index: number) => void): void;
2984
3053
  count(children: any): number;
2985
3054
  only<C>(children: C): C extends any[] ? never : C;
@@ -3050,58 +3119,62 @@ type MergePropTypes<P, T> =
3050
3119
  // Distribute over P in case it is a union type
3051
3120
  P extends any
3052
3121
  // If props is type any, use propTypes definitions
3053
- ? IsExactlyAny<P> extends true ? T :
3122
+ ? IsExactlyAny<P> extends true ? T
3054
3123
  // If declared props have indexed properties, ignore inferred props entirely as keyof gets widened
3055
- string extends keyof P ? P :
3056
- // Prefer declared types which are not exactly any
3057
- & Pick<P, NotExactlyAnyPropertyKeys<P>>
3058
- // For props which are exactly any, use the type inferred from propTypes if present
3059
- & Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>>
3060
- // Keep leftover props not specified in propTypes
3061
- & Pick<P, Exclude<keyof P, keyof T>>
3124
+ : string extends keyof P ? P
3125
+ // Prefer declared types which are not exactly any
3126
+ :
3127
+ & Pick<P, NotExactlyAnyPropertyKeys<P>>
3128
+ // For props which are exactly any, use the type inferred from propTypes if present
3129
+ & Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>>
3130
+ // Keep leftover props not specified in propTypes
3131
+ & Pick<P, Exclude<keyof P, keyof T>>
3062
3132
  : never;
3063
3133
 
3064
3134
  // Any prop that has a default prop becomes optional, but its type is unchanged
3065
3135
  // Undeclared default props are augmented into the resulting allowable attributes
3066
3136
  // If declared props have indexed properties, ignore default props entirely as keyof gets widened
3067
3137
  // Wrap in an outer-level conditional type to allow distribution over props that are unions
3068
- type Defaultize<P, D> = P extends any
3069
- ? string extends keyof P ? P :
3138
+ type Defaultize<P, D> = P extends any ? string extends keyof P ? P
3139
+ :
3070
3140
  & Pick<P, Exclude<keyof P, keyof D>>
3071
3141
  & Partial<Pick<P, Extract<keyof P, keyof D>>>
3072
3142
  & Partial<Pick<D, Exclude<keyof D, keyof P>>>
3073
3143
  : never;
3074
3144
 
3075
- type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D; }
3145
+ type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D }
3076
3146
  ? Defaultize<MergePropTypes<P, PropTypes.InferProps<T>>, D>
3077
- : C extends { propTypes: infer T; }
3078
- ? MergePropTypes<P, PropTypes.InferProps<T>>
3079
- : C extends { defaultProps: infer D; }
3080
- ? Defaultize<P, D>
3081
- : P;
3147
+ : C extends { propTypes: infer T } ? MergePropTypes<P, PropTypes.InferProps<T>>
3148
+ : C extends { defaultProps: infer D } ? Defaultize<P, D>
3149
+ : P;
3082
3150
 
3083
3151
  declare global {
3084
3152
  /**
3085
3153
  * @deprecated Use `React.JSX` instead of the global `JSX` namespace.
3086
3154
  */
3087
3155
  namespace JSX {
3088
- interface Element extends React.ReactElement<any, any> { }
3156
+ interface Element extends React.ReactElement<any, any> {}
3089
3157
  interface ElementClass extends React.Component<any> {
3090
3158
  render(): React.ReactNode;
3091
3159
  }
3092
- interface ElementAttributesProperty { props: {}; }
3093
- interface ElementChildrenAttribute { children: {}; }
3160
+ interface ElementAttributesProperty {
3161
+ props: {};
3162
+ }
3163
+ interface ElementChildrenAttribute {
3164
+ children: {};
3165
+ }
3094
3166
 
3095
3167
  // We can't recurse forever because `type` can't be self-referential;
3096
3168
  // let's assume it's reasonable to do a single React.lazy() around a single React.memo() / vice-versa
3097
- type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
3169
+ type LibraryManagedAttributes<C, P> = C extends
3170
+ React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
3098
3171
  ? T extends React.MemoExoticComponent<infer U> | React.LazyExoticComponent<infer U>
3099
3172
  ? ReactManagedAttributes<U, P>
3100
- : ReactManagedAttributes<T, P>
3173
+ : ReactManagedAttributes<T, P>
3101
3174
  : ReactManagedAttributes<C, P>;
3102
3175
 
3103
- interface IntrinsicAttributes extends React.Attributes { }
3104
- interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> { }
3176
+ interface IntrinsicAttributes extends React.Attributes {}
3177
+ interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {}
3105
3178
 
3106
3179
  interface IntrinsicElements {
3107
3180
  // HTML