@types/react 19.1.2 → 19.2.10
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/README.md +1 -1
- react/canary.d.ts +85 -0
- react/experimental.d.ts +45 -109
- react/global.d.ts +2 -0
- react/index.d.ts +169 -48
- react/package.json +4 -4
- react/ts5.0/canary.d.ts +85 -0
- react/ts5.0/experimental.d.ts +45 -109
- react/ts5.0/global.d.ts +2 -0
- react/ts5.0/index.d.ts +166 -48
- react/ts5.0/v18/global.d.ts +0 -160
- react/ts5.0/v18/index.d.ts +0 -4543
- react/ts5.0/v18/jsx-dev-runtime.d.ts +0 -45
- react/ts5.0/v18/jsx-runtime.d.ts +0 -36
- react/ts5.0/v18/ts5.0/global.d.ts +0 -160
- react/ts5.0/v18/ts5.0/index.d.ts +0 -4530
- react/ts5.0/v18/ts5.0/jsx-dev-runtime.d.ts +0 -44
- react/ts5.0/v18/ts5.0/jsx-runtime.d.ts +0 -35
react/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for react (https://react.dev/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Tue, 27 Jan 2026 12:02:23 GMT
|
|
12
12
|
* Dependencies: [csstype](https://npmjs.com/package/csstype)
|
|
13
13
|
|
|
14
14
|
# Credits
|
react/canary.d.ts
CHANGED
|
@@ -32,4 +32,89 @@ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
|
|
32
32
|
|
|
33
33
|
declare module "." {
|
|
34
34
|
export function unstable_useCacheRefresh(): () => void;
|
|
35
|
+
|
|
36
|
+
// @enableViewTransition
|
|
37
|
+
export interface ViewTransitionInstance {
|
|
38
|
+
/**
|
|
39
|
+
* The {@link ViewTransitionProps name} that was used in the corresponding {@link ViewTransition} component or `"auto"` if the `name` prop was omitted.
|
|
40
|
+
*/
|
|
41
|
+
name: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type ViewTransitionClassPerType = Record<"default" | (string & {}), "none" | "auto" | (string & {})>;
|
|
45
|
+
export type ViewTransitionClass = ViewTransitionClassPerType | ViewTransitionClassPerType[string];
|
|
46
|
+
|
|
47
|
+
export interface ViewTransitionProps {
|
|
48
|
+
children?: ReactNode | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Assigns the {@link https://developer.chrome.com/blog/view-transitions-update-io24#view-transition-class `view-transition-class`} class to the underlying DOM node.
|
|
51
|
+
*/
|
|
52
|
+
default?: ViewTransitionClass | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Combined with {@link className} if this `<ViewTransition>` or its parent Component is mounted and there's no other with the same name being deleted.
|
|
55
|
+
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
56
|
+
*/
|
|
57
|
+
enter?: ViewTransitionClass | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Combined with {@link className} if this `<ViewTransition>` or its parent Component is unmounted and there's no other with the same name being deleted.
|
|
60
|
+
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
61
|
+
*/
|
|
62
|
+
exit?: ViewTransitionClass | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* "auto" will automatically assign a view-transition-name to the inner DOM node.
|
|
65
|
+
* That way you can add a View Transition to a Component without controlling its DOM nodes styling otherwise.
|
|
66
|
+
*
|
|
67
|
+
* A difference between this and the browser's built-in view-transition-name: auto is that switching the DOM nodes within the `<ViewTransition>` component preserves the same name so this example cross-fades between the DOM nodes instead of causing an exit and enter.
|
|
68
|
+
* @default "auto"
|
|
69
|
+
*/
|
|
70
|
+
name?: "auto" | (string & {}) | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* The `<ViewTransition>` or its parent Component is mounted and there's no other `<ViewTransition>` with the same name being deleted.
|
|
73
|
+
*/
|
|
74
|
+
onEnter?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
|
|
75
|
+
/**
|
|
76
|
+
* The `<ViewTransition>` or its parent Component is unmounted and there's no other `<ViewTransition>` with the same name being deleted.
|
|
77
|
+
*/
|
|
78
|
+
onExit?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
|
|
79
|
+
/**
|
|
80
|
+
* This `<ViewTransition>` is being mounted and another `<ViewTransition>` instance with the same name is being unmounted elsewhere.
|
|
81
|
+
*/
|
|
82
|
+
onShare?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
|
|
83
|
+
/**
|
|
84
|
+
* The content of `<ViewTransition>` has changed either due to DOM mutations or because an inner child `<ViewTransition>` has resized.
|
|
85
|
+
*/
|
|
86
|
+
onUpdate?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);
|
|
87
|
+
ref?: Ref<ViewTransitionInstance> | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Combined with {@link className} if this `<ViewTransition>` is being mounted and another instance with the same name is being unmounted elsewhere.
|
|
90
|
+
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
91
|
+
*/
|
|
92
|
+
share?: ViewTransitionClass | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Combined with {@link className} if the content of this `<ViewTransition>` has changed either due to DOM mutations or because an inner child has resized.
|
|
95
|
+
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
96
|
+
*/
|
|
97
|
+
update?: ViewTransitionClass | undefined;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Opt-in for using {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API View Transitions} in React.
|
|
102
|
+
* View Transitions only trigger for async updates like {@link startTransition}, {@link useDeferredValue}, Actions or <{@link Suspense}> revealing from fallback to content.
|
|
103
|
+
* Synchronous updates provide an opt-out but also guarantee that they commit immediately which View Transitions can't.
|
|
104
|
+
*
|
|
105
|
+
* @see {@link https://react.dev/reference/react/ViewTransition `<ViewTransition>` reference documentation}
|
|
106
|
+
*/
|
|
107
|
+
export const ViewTransition: ExoticComponent<ViewTransitionProps>;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @see {@link https://react.dev/reference/react/addTransitionType `addTransitionType` reference documentation}
|
|
111
|
+
*/
|
|
112
|
+
export function addTransitionType(type: string): void;
|
|
113
|
+
|
|
114
|
+
// @enableFragmentRefs
|
|
115
|
+
export interface FragmentInstance {}
|
|
116
|
+
|
|
117
|
+
export interface FragmentProps {
|
|
118
|
+
ref?: Ref<FragmentInstance> | undefined;
|
|
119
|
+
}
|
|
35
120
|
}
|
react/experimental.d.ts
CHANGED
|
@@ -43,18 +43,22 @@ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
|
|
43
43
|
|
|
44
44
|
declare module "." {
|
|
45
45
|
export interface SuspenseProps {
|
|
46
|
+
// @enableCPUSuspense
|
|
46
47
|
/**
|
|
47
48
|
* The presence of this prop indicates that the content is computationally expensive to render.
|
|
48
49
|
* In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
|
|
49
50
|
* @see {@link https://github.com/facebook/react/pull/19936}
|
|
50
51
|
*/
|
|
51
|
-
|
|
52
|
+
defer?: boolean | undefined;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
export type SuspenseListRevealOrder = "forwards" | "backwards" | "together";
|
|
55
|
-
export type SuspenseListTailMode = "collapsed" | "hidden";
|
|
55
|
+
export type SuspenseListRevealOrder = "forwards" | "backwards" | "together" | "independent";
|
|
56
|
+
export type SuspenseListTailMode = "collapsed" | "hidden" | "visible";
|
|
56
57
|
|
|
57
58
|
export interface SuspenseListCommonProps {
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
|
|
58
62
|
/**
|
|
59
63
|
* Note that SuspenseList require more than one child;
|
|
60
64
|
* it is a runtime warning to provide only a single child.
|
|
@@ -62,33 +66,34 @@ declare module "." {
|
|
|
62
66
|
* It does, however, allow those children to be wrapped inside a single
|
|
63
67
|
* level of `<React.Fragment>`.
|
|
64
68
|
*/
|
|
65
|
-
children: ReactElement |
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
|
|
69
|
+
children: Iterable<ReactElement> | AsyncIterable<ReactElement>;
|
|
69
70
|
/**
|
|
70
71
|
* Defines the order in which the `SuspenseList` children should be revealed.
|
|
72
|
+
* @default "forwards"
|
|
71
73
|
*/
|
|
72
|
-
revealOrder
|
|
74
|
+
revealOrder?: "forwards" | "backwards" | "unstable_legacy-backwards" | undefined;
|
|
73
75
|
/**
|
|
74
76
|
* Dictates how unloaded items in a SuspenseList is shown.
|
|
75
77
|
*
|
|
76
|
-
* - By default, `SuspenseList` will show all fallbacks in the list.
|
|
77
78
|
* - `collapsed` shows only the next fallback in the list.
|
|
78
|
-
* - `hidden` doesn
|
|
79
|
+
* - `hidden` doesn't show any unloaded items.
|
|
80
|
+
* - `visible` shows all fallbacks in the list.
|
|
81
|
+
*
|
|
82
|
+
* @default "hidden"
|
|
79
83
|
*/
|
|
80
84
|
tail?: SuspenseListTailMode | undefined;
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
|
|
88
|
+
children: ReactNode;
|
|
84
89
|
/**
|
|
85
90
|
* Defines the order in which the `SuspenseList` children should be revealed.
|
|
86
91
|
*/
|
|
87
|
-
revealOrder
|
|
92
|
+
revealOrder: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps["revealOrder"]>;
|
|
88
93
|
/**
|
|
89
94
|
* The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
|
|
90
95
|
*/
|
|
91
|
-
tail?: never
|
|
96
|
+
tail?: never;
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
|
|
@@ -106,9 +111,6 @@ declare module "." {
|
|
|
106
111
|
*/
|
|
107
112
|
export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
|
|
108
113
|
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
110
|
-
export function experimental_useEffectEvent<T extends Function>(event: T): T;
|
|
111
|
-
|
|
112
114
|
type Reference = object;
|
|
113
115
|
type TaintableUniqueValue = string | bigint | ArrayBufferView;
|
|
114
116
|
function experimental_taintUniqueValue(
|
|
@@ -118,80 +120,6 @@ declare module "." {
|
|
|
118
120
|
): void;
|
|
119
121
|
function experimental_taintObjectReference(message: string | undefined, object: Reference): void;
|
|
120
122
|
|
|
121
|
-
export interface ViewTransitionInstance {
|
|
122
|
-
/**
|
|
123
|
-
* The {@link ViewTransitionProps name} that was used in the corresponding {@link ViewTransition} component or `"auto"` if the `name` prop was omitted.
|
|
124
|
-
*/
|
|
125
|
-
name: string;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export type ViewTransitionClassPerType = Record<"default" | (string & {}), "none" | "auto" | (string & {})>;
|
|
129
|
-
export type ViewTransitionClass = ViewTransitionClassPerType | ViewTransitionClassPerType[string];
|
|
130
|
-
|
|
131
|
-
export interface ViewTransitionProps {
|
|
132
|
-
children?: ReactNode | undefined;
|
|
133
|
-
/**
|
|
134
|
-
* Assigns the {@link https://developer.chrome.com/blog/view-transitions-update-io24#view-transition-class `view-transition-class`} class to the underlying DOM node.
|
|
135
|
-
*/
|
|
136
|
-
default?: ViewTransitionClass | undefined;
|
|
137
|
-
/**
|
|
138
|
-
* Combined with {@link className} if this `<ViewTransition>` or its parent Component is mounted and there's no other with the same name being deleted.
|
|
139
|
-
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
140
|
-
*/
|
|
141
|
-
enter?: ViewTransitionClass | undefined;
|
|
142
|
-
/**
|
|
143
|
-
* Combined with {@link className} if this `<ViewTransition>` or its parent Component is unmounted and there's no other with the same name being deleted.
|
|
144
|
-
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
145
|
-
*/
|
|
146
|
-
exit?: ViewTransitionClass | undefined;
|
|
147
|
-
/**
|
|
148
|
-
* "auto" will automatically assign a view-transition-name to the inner DOM node.
|
|
149
|
-
* That way you can add a View Transition to a Component without controlling its DOM nodes styling otherwise.
|
|
150
|
-
*
|
|
151
|
-
* A difference between this and the browser's built-in view-transition-name: auto is that switching the DOM nodes within the `<ViewTransition>` component preserves the same name so this example cross-fades between the DOM nodes instead of causing an exit and enter.
|
|
152
|
-
* @default "auto"
|
|
153
|
-
*/
|
|
154
|
-
name?: "auto" | (string & {}) | undefined;
|
|
155
|
-
/**
|
|
156
|
-
* The `<ViewTransition>` or its parent Component is mounted and there's no other `<ViewTransition>` with the same name being deleted.
|
|
157
|
-
*/
|
|
158
|
-
onEnter?: (instance: ViewTransitionInstance, types: Array<string>) => void;
|
|
159
|
-
/**
|
|
160
|
-
* The `<ViewTransition>` or its parent Component is unmounted and there's no other `<ViewTransition>` with the same name being deleted.
|
|
161
|
-
*/
|
|
162
|
-
onExit?: (instance: ViewTransitionInstance, types: Array<string>) => void;
|
|
163
|
-
/**
|
|
164
|
-
* This `<ViewTransition>` is being mounted and another `<ViewTransition>` instance with the same name is being unmounted elsewhere.
|
|
165
|
-
*/
|
|
166
|
-
onShare?: (instance: ViewTransitionInstance, types: Array<string>) => void;
|
|
167
|
-
/**
|
|
168
|
-
* The content of `<ViewTransition>` has changed either due to DOM mutations or because an inner child `<ViewTransition>` has resized.
|
|
169
|
-
*/
|
|
170
|
-
onUpdate?: (instance: ViewTransitionInstance, types: Array<string>) => void;
|
|
171
|
-
ref?: Ref<ViewTransitionInstance> | undefined;
|
|
172
|
-
/**
|
|
173
|
-
* Combined with {@link className} if this `<ViewTransition>` is being mounted and another instance with the same name is being unmounted elsewhere.
|
|
174
|
-
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
175
|
-
*/
|
|
176
|
-
share?: ViewTransitionClass | undefined;
|
|
177
|
-
/**
|
|
178
|
-
* Combined with {@link className} if the content of this `<ViewTransition>` has changed either due to DOM mutations or because an inner child has resized.
|
|
179
|
-
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
180
|
-
*/
|
|
181
|
-
update?: ViewTransitionClass | undefined;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Opt-in for using {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API View Transitions} in React.
|
|
186
|
-
* View Transitions only trigger for async updates like {@link startTransition}, {@link useDeferredValue}, Actions or <{@link Suspense}> revealing from fallback to content.
|
|
187
|
-
* Synchronous updates provide an opt-out but also guarantee that they commit immediately which View Transitions can't.
|
|
188
|
-
*
|
|
189
|
-
* @see {@link https://github.com/facebook/react/pull/31975}
|
|
190
|
-
*/
|
|
191
|
-
export const unstable_ViewTransition: ExoticComponent<ViewTransitionProps>;
|
|
192
|
-
|
|
193
|
-
export function unstable_addTransitionType(type: string): void;
|
|
194
|
-
|
|
195
123
|
// @enableGestureTransition
|
|
196
124
|
// Implemented by the specific renderer e.g. `react-dom`.
|
|
197
125
|
// Keep in mind that augmented interfaces merge their JSDoc so if you put
|
|
@@ -201,6 +129,9 @@ declare module "." {
|
|
|
201
129
|
rangeStart?: number | undefined;
|
|
202
130
|
rangeEnd?: number | undefined;
|
|
203
131
|
}
|
|
132
|
+
export type GestureOptionsRequired = {
|
|
133
|
+
[P in keyof GestureOptions]-?: NonNullable<GestureOptions[P]>;
|
|
134
|
+
};
|
|
204
135
|
/** */
|
|
205
136
|
export function unstable_startGestureTransition(
|
|
206
137
|
provider: GestureProvider,
|
|
@@ -208,28 +139,33 @@ declare module "." {
|
|
|
208
139
|
options?: GestureOptions,
|
|
209
140
|
): () => void;
|
|
210
141
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
142
|
+
interface ViewTransitionProps {
|
|
143
|
+
onGestureEnter?: (
|
|
144
|
+
timeline: GestureProvider,
|
|
145
|
+
options: GestureOptionsRequired,
|
|
146
|
+
instance: ViewTransitionInstance,
|
|
147
|
+
types: Array<string>,
|
|
148
|
+
) => void | (() => void);
|
|
149
|
+
onGestureExit?: (
|
|
150
|
+
timeline: GestureProvider,
|
|
151
|
+
options: GestureOptionsRequired,
|
|
152
|
+
instance: ViewTransitionInstance,
|
|
153
|
+
types: Array<string>,
|
|
154
|
+
) => void | (() => void);
|
|
155
|
+
onGestureShare?: (
|
|
156
|
+
timeline: GestureProvider,
|
|
157
|
+
options: GestureOptionsRequired,
|
|
158
|
+
instance: ViewTransitionInstance,
|
|
159
|
+
types: Array<string>,
|
|
160
|
+
) => void | (() => void);
|
|
161
|
+
onGestureUpdate?: (
|
|
162
|
+
timeline: GestureProvider,
|
|
163
|
+
options: GestureOptionsRequired,
|
|
164
|
+
instance: ViewTransitionInstance,
|
|
165
|
+
types: Array<string>,
|
|
166
|
+
) => void | (() => void);
|
|
228
167
|
}
|
|
229
168
|
|
|
230
|
-
/** */
|
|
231
|
-
export const unstable_Activity: ExoticComponent<ActivityProps>;
|
|
232
|
-
|
|
233
169
|
// @enableSrcObject
|
|
234
170
|
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {
|
|
235
171
|
srcObject: Blob;
|
react/global.d.ts
CHANGED
|
@@ -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 SubmitEvent extends Event {}
|
|
20
22
|
interface ToggleEvent extends Event {}
|
|
21
23
|
interface TransitionEvent extends Event {}
|
|
22
24
|
interface UIEvent extends Event {}
|