@types/react 18.3.1 → 18.3.26

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.
@@ -5,11 +5,11 @@
5
5
  This package contains type definitions for react (https://react.dev/).
6
6
 
7
7
  # Details
8
- Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react/v18.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 26 Apr 2024 21:06:49 GMT
11
+ * Last updated: Mon, 06 Oct 2025 21:02:40 GMT
12
12
  * Dependencies: [@types/prop-types](https://npmjs.com/package/@types/prop-types), [csstype](https://npmjs.com/package/csstype)
13
13
 
14
14
  # Credits
15
- These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), [Dale Tan](https://github.com/hellatan), [Priyanshu Rav](https://github.com/priyanshurav), [Dmitry Semigradsky](https://github.com/Semigradsky), and [Matt Pocock](https://github.com/mattpocock).
15
+ These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), [Priyanshu Rav](https://github.com/priyanshurav), [Dmitry Semigradsky](https://github.com/Semigradsky), and [Matt Pocock](https://github.com/mattpocock).
@@ -30,31 +30,10 @@ export {};
30
30
  declare const UNDEFINED_VOID_ONLY: unique symbol;
31
31
  type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
32
32
 
33
- declare module "." {
34
- interface ThenableImpl<T> {
35
- then(onFulfill: (value: T) => unknown, onReject: (error: unknown) => unknown): void | PromiseLike<unknown>;
36
- }
37
- interface UntrackedThenable<T> extends ThenableImpl<T> {
38
- status?: void;
39
- }
40
-
41
- export interface PendingThenable<T> extends ThenableImpl<T> {
42
- status: "pending";
43
- }
44
-
45
- export interface FulfilledThenable<T> extends ThenableImpl<T> {
46
- status: "fulfilled";
47
- value: T;
48
- }
49
-
50
- export interface RejectedThenable<T> extends ThenableImpl<T> {
51
- status: "rejected";
52
- reason: unknown;
53
- }
54
-
55
- export type Thenable<T> = UntrackedThenable<T> | PendingThenable<T> | FulfilledThenable<T> | RejectedThenable<T>;
33
+ type NativeToggleEvent = ToggleEvent;
56
34
 
57
- export type Usable<T> = Thenable<T> | Context<T>;
35
+ declare module "." {
36
+ export type Usable<T> = PromiseLike<T> | Context<T>;
58
37
 
59
38
  export function use<T>(usable: Usable<T>): T;
60
39
 
@@ -82,13 +61,13 @@ declare module "." {
82
61
  defaultValue: T,
83
62
  ): ServerContext<T>;
84
63
 
85
- // eslint-disable-next-line @typescript-eslint/ban-types
64
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
86
65
  export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
87
66
 
88
67
  export function unstable_useCacheRefresh(): () => void;
89
68
 
90
69
  interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {
91
- functions: (formData: FormData) => void;
70
+ functions: (formData: FormData) => void | Promise<void>;
92
71
  }
93
72
 
94
73
  export interface TransitionStartFunction {
@@ -142,6 +121,30 @@ declare module "." {
142
121
  onTransitionStartCapture?: TransitionEventHandler<T> | undefined;
143
122
  }
144
123
 
124
+ type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>;
125
+
126
+ interface HTMLAttributes<T> {
127
+ popover?: "" | "auto" | "manual" | "hint" | undefined;
128
+ popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
129
+ popoverTarget?: string | undefined;
130
+ onToggle?: ToggleEventHandler<T> | undefined;
131
+ onBeforeToggle?: ToggleEventHandler<T> | undefined;
132
+ }
133
+
134
+ interface ToggleEvent<T = Element> extends SyntheticEvent<T, NativeToggleEvent> {
135
+ oldState: "closed" | "open";
136
+ newState: "closed" | "open";
137
+ }
138
+
139
+ interface LinkHTMLAttributes<T> {
140
+ precedence?: string | undefined;
141
+ }
142
+
143
+ interface StyleHTMLAttributes<T> {
144
+ href?: string | undefined;
145
+ precedence?: string | undefined;
146
+ }
147
+
145
148
  /**
146
149
  * @internal Use `Awaited<ReactNode>` instead
147
150
  */
@@ -106,9 +106,14 @@ declare module "." {
106
106
  */
107
107
  export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
108
108
 
109
- // eslint-disable-next-line @typescript-eslint/ban-types
109
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
110
110
  export function experimental_useEffectEvent<T extends Function>(event: T): T;
111
111
 
112
+ /**
113
+ * Warning: Only available in development builds.
114
+ */
115
+ function captureOwnerStack(): string | null;
116
+
112
117
  type Reference = object;
113
118
  type TaintableUniqueValue = string | bigint | ArrayBufferView;
114
119
  function experimental_taintUniqueValue(
@@ -13,10 +13,12 @@ interface ClipboardEvent extends Event {}
13
13
  interface CompositionEvent extends Event {}
14
14
  interface DragEvent extends Event {}
15
15
  interface FocusEvent extends Event {}
16
+ interface InputEvent extends Event {}
16
17
  interface KeyboardEvent extends Event {}
17
18
  interface MouseEvent extends Event {}
18
19
  interface TouchEvent extends Event {}
19
20
  interface PointerEvent extends Event {}
21
+ interface ToggleEvent extends Event {}
20
22
  interface TransitionEvent extends Event {}
21
23
  interface UIEvent extends Event {}
22
24
  interface WheelEvent extends Event {}
@@ -12,6 +12,7 @@ type NativeClipboardEvent = ClipboardEvent;
12
12
  type NativeCompositionEvent = CompositionEvent;
13
13
  type NativeDragEvent = DragEvent;
14
14
  type NativeFocusEvent = FocusEvent;
15
+ type NativeInputEvent = InputEvent;
15
16
  type NativeKeyboardEvent = KeyboardEvent;
16
17
  type NativeMouseEvent = MouseEvent;
17
18
  type NativeTouchEvent = TouchEvent;
@@ -382,37 +383,44 @@ declare namespace React {
382
383
  // Factories
383
384
  // ----------------------------------------------------------------------
384
385
 
386
+ /** @deprecated */
385
387
  type Factory<P> = (props?: Attributes & P, ...children: ReactNode[]) => ReactElement<P>;
386
388
 
387
- /**
388
- * @deprecated Please use `FunctionComponentFactory`
389
- */
389
+ /** @deprecated */
390
390
  type SFCFactory<P> = FunctionComponentFactory<P>;
391
391
 
392
+ /** @deprecated */
392
393
  type FunctionComponentFactory<P> = (
393
394
  props?: Attributes & P,
394
395
  ...children: ReactNode[]
395
396
  ) => FunctionComponentElement<P>;
396
397
 
398
+ /** @deprecated */
397
399
  type ComponentFactory<P, T extends Component<P, ComponentState>> = (
398
400
  props?: ClassAttributes<T> & P,
399
401
  ...children: ReactNode[]
400
402
  ) => CElement<P, T>;
401
403
 
404
+ /** @deprecated */
402
405
  type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>;
406
+ /** @deprecated */
403
407
  type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>;
404
408
 
409
+ /** @deprecated */
405
410
  type DOMFactory<P extends DOMAttributes<T>, T extends Element> = (
406
411
  props?: ClassAttributes<T> & P | null,
407
412
  ...children: ReactNode[]
408
413
  ) => DOMElement<P, T>;
409
414
 
415
+ /** @deprecated */
410
416
  interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {}
411
417
 
418
+ /** @deprecated */
412
419
  interface DetailedHTMLFactory<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMFactory<P, T> {
413
420
  (props?: ClassAttributes<T> & P | null, ...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
414
421
  }
415
422
 
423
+ /** @deprecated */
416
424
  interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> {
417
425
  (
418
426
  props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null,
@@ -848,6 +856,12 @@ declare namespace React {
848
856
 
849
857
  /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */
850
858
  fallback?: ReactNode;
859
+
860
+ /**
861
+ * A name for this Suspense boundary for instrumentation purposes.
862
+ * The name will help identify this boundary in React DevTools.
863
+ */
864
+ name?: string | undefined;
851
865
  }
852
866
 
853
867
  /**
@@ -1597,7 +1611,7 @@ declare namespace React {
1597
1611
  * ```
1598
1612
  */
1599
1613
  function forwardRef<T, P = {}>(
1600
- render: ForwardRefRenderFunction<T, P>,
1614
+ render: ForwardRefRenderFunction<T, PropsWithoutRef<P>>,
1601
1615
  ): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
1602
1616
 
1603
1617
  /**
@@ -2004,7 +2018,7 @@ declare namespace React {
2004
2018
  * @version 16.8.0
2005
2019
  * @see {@link https://react.dev/reference/react/useRef}
2006
2020
  */
2007
- function useRef<T = undefined>(): MutableRefObject<T | undefined>;
2021
+ function useRef<T = undefined>(initialValue?: undefined): MutableRefObject<T | undefined>;
2008
2022
  /**
2009
2023
  * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations.
2010
2024
  * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside
@@ -2051,7 +2065,7 @@ declare namespace React {
2051
2065
  */
2052
2066
  // A specific function type would not trigger implicit any.
2053
2067
  // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types.
2054
- // eslint-disable-next-line @typescript-eslint/ban-types
2068
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
2055
2069
  function useCallback<T extends Function>(callback: T, deps: DependencyList): T;
2056
2070
  /**
2057
2071
  * `useMemo` will only recompute the memoized value when one of the `deps` has changed.
@@ -2236,6 +2250,10 @@ declare namespace React {
2236
2250
  target: EventTarget & T;
2237
2251
  }
2238
2252
 
2253
+ interface InputEvent<T = Element> extends SyntheticEvent<T, NativeInputEvent> {
2254
+ data: string;
2255
+ }
2256
+
2239
2257
  export type ModifierKey =
2240
2258
  | "Alt"
2241
2259
  | "AltGraph"
@@ -2351,6 +2369,7 @@ declare namespace React {
2351
2369
  type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
2352
2370
  type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
2353
2371
  type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
2372
+ type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
2354
2373
  type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
2355
2374
  type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
2356
2375
  type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
@@ -2408,7 +2427,7 @@ declare namespace React {
2408
2427
  // Form Events
2409
2428
  onChange?: FormEventHandler<T> | undefined;
2410
2429
  onChangeCapture?: FormEventHandler<T> | undefined;
2411
- onBeforeInput?: FormEventHandler<T> | undefined;
2430
+ onBeforeInput?: InputEventHandler<T> | undefined;
2412
2431
  onBeforeInputCapture?: FormEventHandler<T> | undefined;
2413
2432
  onInput?: FormEventHandler<T> | undefined;
2414
2433
  onInputCapture?: FormEventHandler<T> | undefined;
@@ -2428,9 +2447,9 @@ declare namespace React {
2428
2447
  // Keyboard Events
2429
2448
  onKeyDown?: KeyboardEventHandler<T> | undefined;
2430
2449
  onKeyDownCapture?: KeyboardEventHandler<T> | undefined;
2431
- /** @deprecated */
2450
+ /** @deprecated Use `onKeyUp` or `onKeyDown` instead */
2432
2451
  onKeyPress?: KeyboardEventHandler<T> | undefined;
2433
- /** @deprecated */
2452
+ /** @deprecated Use `onKeyUpCapture` or `onKeyDownCapture` instead */
2434
2453
  onKeyPressCapture?: KeyboardEventHandler<T> | undefined;
2435
2454
  onKeyUp?: KeyboardEventHandler<T> | undefined;
2436
2455
  onKeyUpCapture?: KeyboardEventHandler<T> | undefined;
@@ -2466,8 +2485,6 @@ declare namespace React {
2466
2485
  onProgressCapture?: ReactEventHandler<T> | undefined;
2467
2486
  onRateChange?: ReactEventHandler<T> | undefined;
2468
2487
  onRateChangeCapture?: ReactEventHandler<T> | undefined;
2469
- onResize?: ReactEventHandler<T> | undefined;
2470
- onResizeCapture?: ReactEventHandler<T> | undefined;
2471
2488
  onSeeked?: ReactEventHandler<T> | undefined;
2472
2489
  onSeekedCapture?: ReactEventHandler<T> | undefined;
2473
2490
  onSeeking?: ReactEventHandler<T> | undefined;
@@ -2893,12 +2910,14 @@ declare namespace React {
2893
2910
 
2894
2911
  // Standard HTML Attributes
2895
2912
  accessKey?: string | undefined;
2913
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
2896
2914
  autoFocus?: boolean | undefined;
2897
2915
  className?: string | undefined;
2898
2916
  contentEditable?: Booleanish | "inherit" | "plaintext-only" | undefined;
2899
2917
  contextMenu?: string | undefined;
2900
2918
  dir?: string | undefined;
2901
2919
  draggable?: Booleanish | undefined;
2920
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
2902
2921
  hidden?: boolean | undefined;
2903
2922
  id?: string | undefined;
2904
2923
  lang?: string | undefined;
@@ -2930,7 +2949,6 @@ declare namespace React {
2930
2949
  vocab?: string | undefined;
2931
2950
 
2932
2951
  // Non-standard Attributes
2933
- autoCapitalize?: string | undefined;
2934
2952
  autoCorrect?: string | undefined;
2935
2953
  autoSave?: string | undefined;
2936
2954
  color?: string | undefined;
@@ -2954,6 +2972,14 @@ declare namespace React {
2954
2972
  * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is}
2955
2973
  */
2956
2974
  is?: string | undefined;
2975
+ /**
2976
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts}
2977
+ */
2978
+ exportparts?: string | undefined;
2979
+ /**
2980
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part}
2981
+ */
2982
+ part?: string | undefined;
2957
2983
  }
2958
2984
 
2959
2985
  /**
@@ -3179,6 +3205,7 @@ declare namespace React {
3179
3205
  }
3180
3206
 
3181
3207
  interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
3208
+ closedby?: "any" | "closerequest" | "none" | undefined;
3182
3209
  onCancel?: ReactEventHandler<T> | undefined;
3183
3210
  onClose?: ReactEventHandler<T> | undefined;
3184
3211
  open?: boolean | undefined;
@@ -3354,7 +3381,6 @@ declare namespace React {
3354
3381
  capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
3355
3382
  checked?: boolean | undefined;
3356
3383
  disabled?: boolean | undefined;
3357
- enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
3358
3384
  form?: string | undefined;
3359
3385
  formAction?:
3360
3386
  | string
@@ -3408,6 +3434,7 @@ declare namespace React {
3408
3434
 
3409
3435
  interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
3410
3436
  as?: string | undefined;
3437
+ blocking?: "render" | (string & {}) | undefined;
3411
3438
  crossOrigin?: CrossOrigin;
3412
3439
  fetchPriority?: "high" | "low" | "auto";
3413
3440
  href?: string | undefined;
@@ -3517,6 +3544,7 @@ declare namespace React {
3517
3544
 
3518
3545
  interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
3519
3546
  async?: boolean | undefined;
3547
+ blocking?: "render" | (string & {}) | undefined;
3520
3548
  /** @deprecated */
3521
3549
  charSet?: string | undefined;
3522
3550
  crossOrigin?: CrossOrigin;
@@ -3551,6 +3579,7 @@ declare namespace React {
3551
3579
  }
3552
3580
 
3553
3581
  interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
3582
+ blocking?: "render" | (string & {}) | undefined;
3554
3583
  media?: string | undefined;
3555
3584
  scoped?: boolean | undefined;
3556
3585
  type?: string | undefined;
@@ -3627,6 +3656,9 @@ declare namespace React {
3627
3656
  width?: number | string | undefined;
3628
3657
  disablePictureInPicture?: boolean | undefined;
3629
3658
  disableRemotePlayback?: boolean | undefined;
3659
+
3660
+ onResize?: ReactEventHandler<T> | undefined;
3661
+ onResizeCapture?: ReactEventHandler<T> | undefined;
3630
3662
  }
3631
3663
 
3632
3664
  // this list is "complete" in that it contains every SVG attribute
@@ -3720,7 +3752,21 @@ declare namespace React {
3720
3752
  direction?: number | string | undefined;
3721
3753
  display?: number | string | undefined;
3722
3754
  divisor?: number | string | undefined;
3723
- dominantBaseline?: number | string | undefined;
3755
+ dominantBaseline?:
3756
+ | "auto"
3757
+ | "use-script"
3758
+ | "no-change"
3759
+ | "reset-size"
3760
+ | "ideographic"
3761
+ | "alphabetic"
3762
+ | "hanging"
3763
+ | "mathematical"
3764
+ | "central"
3765
+ | "middle"
3766
+ | "text-after-edge"
3767
+ | "text-before-edge"
3768
+ | "inherit"
3769
+ | undefined;
3724
3770
  dur?: number | string | undefined;
3725
3771
  dx?: number | string | undefined;
3726
3772
  dy?: number | string | undefined;
@@ -3867,12 +3913,13 @@ declare namespace React {
3867
3913
  tableValues?: number | string | undefined;
3868
3914
  targetX?: number | string | undefined;
3869
3915
  targetY?: number | string | undefined;
3870
- textAnchor?: string | undefined;
3916
+ textAnchor?: "start" | "middle" | "end" | "inherit" | undefined;
3871
3917
  textDecoration?: number | string | undefined;
3872
3918
  textLength?: number | string | undefined;
3873
3919
  textRendering?: number | string | undefined;
3874
3920
  to?: number | string | undefined;
3875
3921
  transform?: string | undefined;
3922
+ transformOrigin?: string | undefined;
3876
3923
  u1?: number | string | undefined;
3877
3924
  u2?: number | string | undefined;
3878
3925
  underlinePosition?: number | string | undefined;
@@ -3945,6 +3992,7 @@ declare namespace React {
3945
3992
  // React.DOM
3946
3993
  // ----------------------------------------------------------------------
3947
3994
 
3995
+ /* deprecated */
3948
3996
  interface ReactHTML {
3949
3997
  a: DetailedHTMLFactory<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
3950
3998
  abbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
@@ -4066,6 +4114,7 @@ declare namespace React {
4066
4114
  webview: DetailedHTMLFactory<WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>;
4067
4115
  }
4068
4116
 
4117
+ /* deprecated */
4069
4118
  interface ReactSVG {
4070
4119
  animate: SVGFactory;
4071
4120
  circle: SVGFactory;
@@ -4124,6 +4173,7 @@ declare namespace React {
4124
4173
  view: SVGFactory;
4125
4174
  }
4126
4175
 
4176
+ /* deprecated */
4127
4177
  interface ReactDOM extends ReactHTML, ReactSVG {}
4128
4178
 
4129
4179
  //
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "18.3.1",
3
+ "version": "18.3.26",
4
4
  "description": "TypeScript definitions for react",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -122,11 +122,6 @@
122
122
  "githubUsername": "vhfmag",
123
123
  "url": "https://github.com/vhfmag"
124
124
  },
125
- {
126
- "name": "Dale Tan",
127
- "githubUsername": "hellatan",
128
- "url": "https://github.com/hellatan"
129
- },
130
125
  {
131
126
  "name": "Priyanshu Rav",
132
127
  "githubUsername": "priyanshurav",
@@ -205,6 +200,7 @@
205
200
  "@types/prop-types": "*",
206
201
  "csstype": "^3.0.2"
207
202
  },
208
- "typesPublisherContentHash": "0a7e72b3c121016aa40006c290d4d367a7a99b6bf63c3884af050937991f6ddd",
209
- "typeScriptVersion": "4.7"
203
+ "peerDependencies": {},
204
+ "typesPublisherContentHash": "76d9489e0295ad25d05b8021949dcbb349e49bd993c765d791afe1126656c589",
205
+ "typeScriptVersion": "5.2"
210
206
  }
@@ -30,31 +30,10 @@ export {};
30
30
  declare const UNDEFINED_VOID_ONLY: unique symbol;
31
31
  type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
32
32
 
33
- declare module "." {
34
- interface ThenableImpl<T> {
35
- then(onFulfill: (value: T) => unknown, onReject: (error: unknown) => unknown): void | PromiseLike<unknown>;
36
- }
37
- interface UntrackedThenable<T> extends ThenableImpl<T> {
38
- status?: void;
39
- }
40
-
41
- export interface PendingThenable<T> extends ThenableImpl<T> {
42
- status: "pending";
43
- }
44
-
45
- export interface FulfilledThenable<T> extends ThenableImpl<T> {
46
- status: "fulfilled";
47
- value: T;
48
- }
49
-
50
- export interface RejectedThenable<T> extends ThenableImpl<T> {
51
- status: "rejected";
52
- reason: unknown;
53
- }
54
-
55
- export type Thenable<T> = UntrackedThenable<T> | PendingThenable<T> | FulfilledThenable<T> | RejectedThenable<T>;
33
+ type NativeToggleEvent = ToggleEvent;
56
34
 
57
- export type Usable<T> = Thenable<T> | Context<T>;
35
+ declare module "." {
36
+ export type Usable<T> = PromiseLike<T> | Context<T>;
58
37
 
59
38
  export function use<T>(usable: Usable<T>): T;
60
39
 
@@ -82,13 +61,13 @@ declare module "." {
82
61
  defaultValue: T,
83
62
  ): ServerContext<T>;
84
63
 
85
- // eslint-disable-next-line @typescript-eslint/ban-types
64
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
86
65
  export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
87
66
 
88
67
  export function unstable_useCacheRefresh(): () => void;
89
68
 
90
69
  interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {
91
- functions: (formData: FormData) => void;
70
+ functions: (formData: FormData) => void | Promise<void>;
92
71
  }
93
72
 
94
73
  export interface TransitionStartFunction {
@@ -142,6 +121,30 @@ declare module "." {
142
121
  onTransitionStartCapture?: TransitionEventHandler<T> | undefined;
143
122
  }
144
123
 
124
+ type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>;
125
+
126
+ interface HTMLAttributes<T> {
127
+ popover?: "" | "auto" | "manual" | "hint" | undefined;
128
+ popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
129
+ popoverTarget?: string | undefined;
130
+ onToggle?: ToggleEventHandler<T> | undefined;
131
+ onBeforeToggle?: ToggleEventHandler<T> | undefined;
132
+ }
133
+
134
+ interface ToggleEvent<T = Element> extends SyntheticEvent<T, NativeToggleEvent> {
135
+ oldState: "closed" | "open";
136
+ newState: "closed" | "open";
137
+ }
138
+
139
+ interface LinkHTMLAttributes<T> {
140
+ precedence?: string | undefined;
141
+ }
142
+
143
+ interface StyleHTMLAttributes<T> {
144
+ href?: string | undefined;
145
+ precedence?: string | undefined;
146
+ }
147
+
145
148
  /**
146
149
  * @internal Use `Awaited<ReactNode>` instead
147
150
  */
@@ -106,9 +106,14 @@ declare module "." {
106
106
  */
107
107
  export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
108
108
 
109
- // eslint-disable-next-line @typescript-eslint/ban-types
109
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
110
110
  export function experimental_useEffectEvent<T extends Function>(event: T): T;
111
111
 
112
+ /**
113
+ * Warning: Only available in development builds.
114
+ */
115
+ function captureOwnerStack(): string | null;
116
+
112
117
  type Reference = object;
113
118
  type TaintableUniqueValue = string | bigint | ArrayBufferView;
114
119
  function experimental_taintUniqueValue(
@@ -13,10 +13,12 @@ interface ClipboardEvent extends Event {}
13
13
  interface CompositionEvent extends Event {}
14
14
  interface DragEvent extends Event {}
15
15
  interface FocusEvent extends Event {}
16
+ interface InputEvent extends Event {}
16
17
  interface KeyboardEvent extends Event {}
17
18
  interface MouseEvent extends Event {}
18
19
  interface TouchEvent extends Event {}
19
20
  interface PointerEvent extends Event {}
21
+ interface ToggleEvent extends Event {}
20
22
  interface TransitionEvent extends Event {}
21
23
  interface UIEvent extends Event {}
22
24
  interface WheelEvent extends Event {}
@@ -12,6 +12,7 @@ type NativeClipboardEvent = ClipboardEvent;
12
12
  type NativeCompositionEvent = CompositionEvent;
13
13
  type NativeDragEvent = DragEvent;
14
14
  type NativeFocusEvent = FocusEvent;
15
+ type NativeInputEvent = InputEvent;
15
16
  type NativeKeyboardEvent = KeyboardEvent;
16
17
  type NativeMouseEvent = MouseEvent;
17
18
  type NativeTouchEvent = TouchEvent;
@@ -382,37 +383,44 @@ declare namespace React {
382
383
  // Factories
383
384
  // ----------------------------------------------------------------------
384
385
 
386
+ /** @deprecated */
385
387
  type Factory<P> = (props?: Attributes & P, ...children: ReactNode[]) => ReactElement<P>;
386
388
 
387
- /**
388
- * @deprecated Please use `FunctionComponentFactory`
389
- */
389
+ /** @deprecated */
390
390
  type SFCFactory<P> = FunctionComponentFactory<P>;
391
391
 
392
+ /** @deprecated */
392
393
  type FunctionComponentFactory<P> = (
393
394
  props?: Attributes & P,
394
395
  ...children: ReactNode[]
395
396
  ) => FunctionComponentElement<P>;
396
397
 
398
+ /** @deprecated */
397
399
  type ComponentFactory<P, T extends Component<P, ComponentState>> = (
398
400
  props?: ClassAttributes<T> & P,
399
401
  ...children: ReactNode[]
400
402
  ) => CElement<P, T>;
401
403
 
404
+ /** @deprecated */
402
405
  type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>;
406
+ /** @deprecated */
403
407
  type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>;
404
408
 
409
+ /** @deprecated */
405
410
  type DOMFactory<P extends DOMAttributes<T>, T extends Element> = (
406
411
  props?: ClassAttributes<T> & P | null,
407
412
  ...children: ReactNode[]
408
413
  ) => DOMElement<P, T>;
409
414
 
415
+ /** @deprecated */
410
416
  interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {}
411
417
 
418
+ /** @deprecated */
412
419
  interface DetailedHTMLFactory<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMFactory<P, T> {
413
420
  (props?: ClassAttributes<T> & P | null, ...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
414
421
  }
415
422
 
423
+ /** @deprecated */
416
424
  interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> {
417
425
  (
418
426
  props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null,
@@ -849,6 +857,12 @@ declare namespace React {
849
857
 
850
858
  /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */
851
859
  fallback?: ReactNode;
860
+
861
+ /**
862
+ * A name for this Suspense boundary for instrumentation purposes.
863
+ * The name will help identify this boundary in React DevTools.
864
+ */
865
+ name?: string | undefined;
852
866
  }
853
867
 
854
868
  /**
@@ -1598,7 +1612,7 @@ declare namespace React {
1598
1612
  * ```
1599
1613
  */
1600
1614
  function forwardRef<T, P = {}>(
1601
- render: ForwardRefRenderFunction<T, P>,
1615
+ render: ForwardRefRenderFunction<T, PropsWithoutRef<P>>,
1602
1616
  ): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
1603
1617
 
1604
1618
  /**
@@ -2005,7 +2019,7 @@ declare namespace React {
2005
2019
  * @version 16.8.0
2006
2020
  * @see {@link https://react.dev/reference/react/useRef}
2007
2021
  */
2008
- function useRef<T = undefined>(): MutableRefObject<T | undefined>;
2022
+ function useRef<T = undefined>(initialValue?: undefined): MutableRefObject<T | undefined>;
2009
2023
  /**
2010
2024
  * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations.
2011
2025
  * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside
@@ -2052,7 +2066,7 @@ declare namespace React {
2052
2066
  */
2053
2067
  // A specific function type would not trigger implicit any.
2054
2068
  // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types.
2055
- // eslint-disable-next-line @typescript-eslint/ban-types
2069
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
2056
2070
  function useCallback<T extends Function>(callback: T, deps: DependencyList): T;
2057
2071
  /**
2058
2072
  * `useMemo` will only recompute the memoized value when one of the `deps` has changed.
@@ -2237,6 +2251,10 @@ declare namespace React {
2237
2251
  target: EventTarget & T;
2238
2252
  }
2239
2253
 
2254
+ interface InputEvent<T = Element> extends SyntheticEvent<T, NativeInputEvent> {
2255
+ data: string;
2256
+ }
2257
+
2240
2258
  export type ModifierKey =
2241
2259
  | "Alt"
2242
2260
  | "AltGraph"
@@ -2352,6 +2370,7 @@ declare namespace React {
2352
2370
  type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
2353
2371
  type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
2354
2372
  type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
2373
+ type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
2355
2374
  type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
2356
2375
  type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
2357
2376
  type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
@@ -2409,7 +2428,7 @@ declare namespace React {
2409
2428
  // Form Events
2410
2429
  onChange?: FormEventHandler<T> | undefined;
2411
2430
  onChangeCapture?: FormEventHandler<T> | undefined;
2412
- onBeforeInput?: FormEventHandler<T> | undefined;
2431
+ onBeforeInput?: InputEventHandler<T> | undefined;
2413
2432
  onBeforeInputCapture?: FormEventHandler<T> | undefined;
2414
2433
  onInput?: FormEventHandler<T> | undefined;
2415
2434
  onInputCapture?: FormEventHandler<T> | undefined;
@@ -2429,9 +2448,9 @@ declare namespace React {
2429
2448
  // Keyboard Events
2430
2449
  onKeyDown?: KeyboardEventHandler<T> | undefined;
2431
2450
  onKeyDownCapture?: KeyboardEventHandler<T> | undefined;
2432
- /** @deprecated */
2451
+ /** @deprecated Use `onKeyUp` or `onKeyDown` instead */
2433
2452
  onKeyPress?: KeyboardEventHandler<T> | undefined;
2434
- /** @deprecated */
2453
+ /** @deprecated Use `onKeyUpCapture` or `onKeyDownCapture` instead */
2435
2454
  onKeyPressCapture?: KeyboardEventHandler<T> | undefined;
2436
2455
  onKeyUp?: KeyboardEventHandler<T> | undefined;
2437
2456
  onKeyUpCapture?: KeyboardEventHandler<T> | undefined;
@@ -2467,8 +2486,6 @@ declare namespace React {
2467
2486
  onProgressCapture?: ReactEventHandler<T> | undefined;
2468
2487
  onRateChange?: ReactEventHandler<T> | undefined;
2469
2488
  onRateChangeCapture?: ReactEventHandler<T> | undefined;
2470
- onResize?: ReactEventHandler<T> | undefined;
2471
- onResizeCapture?: ReactEventHandler<T> | undefined;
2472
2489
  onSeeked?: ReactEventHandler<T> | undefined;
2473
2490
  onSeekedCapture?: ReactEventHandler<T> | undefined;
2474
2491
  onSeeking?: ReactEventHandler<T> | undefined;
@@ -2894,12 +2911,14 @@ declare namespace React {
2894
2911
 
2895
2912
  // Standard HTML Attributes
2896
2913
  accessKey?: string | undefined;
2914
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
2897
2915
  autoFocus?: boolean | undefined;
2898
2916
  className?: string | undefined;
2899
2917
  contentEditable?: Booleanish | "inherit" | "plaintext-only" | undefined;
2900
2918
  contextMenu?: string | undefined;
2901
2919
  dir?: string | undefined;
2902
2920
  draggable?: Booleanish | undefined;
2921
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
2903
2922
  hidden?: boolean | undefined;
2904
2923
  id?: string | undefined;
2905
2924
  lang?: string | undefined;
@@ -2931,7 +2950,6 @@ declare namespace React {
2931
2950
  vocab?: string | undefined;
2932
2951
 
2933
2952
  // Non-standard Attributes
2934
- autoCapitalize?: string | undefined;
2935
2953
  autoCorrect?: string | undefined;
2936
2954
  autoSave?: string | undefined;
2937
2955
  color?: string | undefined;
@@ -2955,6 +2973,14 @@ declare namespace React {
2955
2973
  * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is}
2956
2974
  */
2957
2975
  is?: string | undefined;
2976
+ /**
2977
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts}
2978
+ */
2979
+ exportparts?: string | undefined;
2980
+ /**
2981
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part}
2982
+ */
2983
+ part?: string | undefined;
2958
2984
  }
2959
2985
 
2960
2986
  /**
@@ -3180,6 +3206,7 @@ declare namespace React {
3180
3206
  }
3181
3207
 
3182
3208
  interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
3209
+ closedby?: "any" | "closerequest" | "none" | undefined;
3183
3210
  onCancel?: ReactEventHandler<T> | undefined;
3184
3211
  onClose?: ReactEventHandler<T> | undefined;
3185
3212
  open?: boolean | undefined;
@@ -3355,7 +3382,6 @@ declare namespace React {
3355
3382
  capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
3356
3383
  checked?: boolean | undefined;
3357
3384
  disabled?: boolean | undefined;
3358
- enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
3359
3385
  form?: string | undefined;
3360
3386
  formAction?:
3361
3387
  | string
@@ -3409,6 +3435,7 @@ declare namespace React {
3409
3435
 
3410
3436
  interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
3411
3437
  as?: string | undefined;
3438
+ blocking?: "render" | (string & {}) | undefined;
3412
3439
  crossOrigin?: CrossOrigin;
3413
3440
  fetchPriority?: "high" | "low" | "auto";
3414
3441
  href?: string | undefined;
@@ -3518,6 +3545,7 @@ declare namespace React {
3518
3545
 
3519
3546
  interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
3520
3547
  async?: boolean | undefined;
3548
+ blocking?: "render" | (string & {}) | undefined;
3521
3549
  /** @deprecated */
3522
3550
  charSet?: string | undefined;
3523
3551
  crossOrigin?: CrossOrigin;
@@ -3552,6 +3580,7 @@ declare namespace React {
3552
3580
  }
3553
3581
 
3554
3582
  interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
3583
+ blocking?: "render" | (string & {}) | undefined;
3555
3584
  media?: string | undefined;
3556
3585
  scoped?: boolean | undefined;
3557
3586
  type?: string | undefined;
@@ -3628,6 +3657,9 @@ declare namespace React {
3628
3657
  width?: number | string | undefined;
3629
3658
  disablePictureInPicture?: boolean | undefined;
3630
3659
  disableRemotePlayback?: boolean | undefined;
3660
+
3661
+ onResize?: ReactEventHandler<T> | undefined;
3662
+ onResizeCapture?: ReactEventHandler<T> | undefined;
3631
3663
  }
3632
3664
 
3633
3665
  // this list is "complete" in that it contains every SVG attribute
@@ -3721,7 +3753,21 @@ declare namespace React {
3721
3753
  direction?: number | string | undefined;
3722
3754
  display?: number | string | undefined;
3723
3755
  divisor?: number | string | undefined;
3724
- dominantBaseline?: number | string | undefined;
3756
+ dominantBaseline?:
3757
+ | "auto"
3758
+ | "use-script"
3759
+ | "no-change"
3760
+ | "reset-size"
3761
+ | "ideographic"
3762
+ | "alphabetic"
3763
+ | "hanging"
3764
+ | "mathematical"
3765
+ | "central"
3766
+ | "middle"
3767
+ | "text-after-edge"
3768
+ | "text-before-edge"
3769
+ | "inherit"
3770
+ | undefined;
3725
3771
  dur?: number | string | undefined;
3726
3772
  dx?: number | string | undefined;
3727
3773
  dy?: number | string | undefined;
@@ -3868,7 +3914,7 @@ declare namespace React {
3868
3914
  tableValues?: number | string | undefined;
3869
3915
  targetX?: number | string | undefined;
3870
3916
  targetY?: number | string | undefined;
3871
- textAnchor?: string | undefined;
3917
+ textAnchor?: "start" | "middle" | "end" | "inherit" | undefined;
3872
3918
  textDecoration?: number | string | undefined;
3873
3919
  textLength?: number | string | undefined;
3874
3920
  textRendering?: number | string | undefined;
@@ -3946,6 +3992,7 @@ declare namespace React {
3946
3992
  // React.DOM
3947
3993
  // ----------------------------------------------------------------------
3948
3994
 
3995
+ /* deprecated */
3949
3996
  interface ReactHTML {
3950
3997
  a: DetailedHTMLFactory<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
3951
3998
  abbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
@@ -4067,6 +4114,7 @@ declare namespace React {
4067
4114
  webview: DetailedHTMLFactory<WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>;
4068
4115
  }
4069
4116
 
4117
+ /* deprecated */
4070
4118
  interface ReactSVG {
4071
4119
  animate: SVGFactory;
4072
4120
  circle: SVGFactory;
@@ -4125,6 +4173,7 @@ declare namespace React {
4125
4173
  view: SVGFactory;
4126
4174
  }
4127
4175
 
4176
+ /* deprecated */
4128
4177
  interface ReactDOM extends ReactHTML, ReactSVG {}
4129
4178
 
4130
4179
  //
File without changes
File without changes
File without changes
File without changes
File without changes