@types/react 19.1.2 → 19.2.4
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 +17 -111
- react/global.d.ts +1 -0
- react/index.d.ts +87 -27
- react/package.json +3 -3
- react/ts5.0/canary.d.ts +85 -0
- react/ts5.0/experimental.d.ts +17 -111
- react/ts5.0/global.d.ts +1 -0
- react/ts5.0/index.d.ts +87 -27
- 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: Wed, 12 Nov 2025 16:02:25 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;
|
|
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;
|
|
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;
|
|
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;
|
|
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
|
|
@@ -208,28 +136,6 @@ declare module "." {
|
|
|
208
136
|
options?: GestureOptions,
|
|
209
137
|
): () => void;
|
|
210
138
|
|
|
211
|
-
// @enableFragmentRefs
|
|
212
|
-
export interface FragmentInstance {}
|
|
213
|
-
|
|
214
|
-
export interface FragmentProps {
|
|
215
|
-
ref?: Ref<FragmentInstance> | undefined;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// @enableActivity
|
|
219
|
-
export interface ActivityProps {
|
|
220
|
-
/**
|
|
221
|
-
* @default "visible"
|
|
222
|
-
*/
|
|
223
|
-
mode?:
|
|
224
|
-
| "hidden"
|
|
225
|
-
| "visible"
|
|
226
|
-
| undefined;
|
|
227
|
-
children: ReactNode;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/** */
|
|
231
|
-
export const unstable_Activity: ExoticComponent<ActivityProps>;
|
|
232
|
-
|
|
233
139
|
// @enableSrcObject
|
|
234
140
|
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {
|
|
235
141
|
srcObject: Blob;
|
react/global.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ 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 {}
|
react/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ type NativeClipboardEvent = ClipboardEvent;
|
|
|
11
11
|
type NativeCompositionEvent = CompositionEvent;
|
|
12
12
|
type NativeDragEvent = DragEvent;
|
|
13
13
|
type NativeFocusEvent = FocusEvent;
|
|
14
|
+
type NativeInputEvent = InputEvent;
|
|
14
15
|
type NativeKeyboardEvent = KeyboardEvent;
|
|
15
16
|
type NativeMouseEvent = MouseEvent;
|
|
16
17
|
type NativeTouchEvent = TouchEvent;
|
|
@@ -134,7 +135,7 @@ declare namespace React {
|
|
|
134
135
|
props: P,
|
|
135
136
|
) => ReactNode | Promise<ReactNode>)
|
|
136
137
|
// constructor signature must match React.Component
|
|
137
|
-
| (new(props: P) => Component<any, any>);
|
|
138
|
+
| (new(props: P, context: any) => Component<any, any>);
|
|
138
139
|
|
|
139
140
|
/**
|
|
140
141
|
* Created by {@link createRef}, or {@link useRef} when passed `null`.
|
|
@@ -217,7 +218,7 @@ declare namespace React {
|
|
|
217
218
|
type ElementRef<
|
|
218
219
|
C extends
|
|
219
220
|
| ForwardRefExoticComponent<any>
|
|
220
|
-
| { new(props: any): Component<any> }
|
|
221
|
+
| { new(props: any, context: any): Component<any> }
|
|
221
222
|
| ((props: any) => ReactNode)
|
|
222
223
|
| keyof JSX.IntrinsicElements,
|
|
223
224
|
> = ComponentRef<C>;
|
|
@@ -927,7 +928,7 @@ declare namespace React {
|
|
|
927
928
|
static propTypes?: any;
|
|
928
929
|
|
|
929
930
|
/**
|
|
930
|
-
* If using
|
|
931
|
+
* If using React Context, re-declare this in your class to be the
|
|
931
932
|
* `React.ContextType` of your `static contextType`.
|
|
932
933
|
* Should be used with type annotation or static contextType.
|
|
933
934
|
*
|
|
@@ -946,6 +947,14 @@ declare namespace React {
|
|
|
946
947
|
|
|
947
948
|
// Keep in sync with constructor signature of JSXElementConstructor and ComponentClass.
|
|
948
949
|
constructor(props: P);
|
|
950
|
+
/**
|
|
951
|
+
* @param props
|
|
952
|
+
* @param context value of the parent {@link https://react.dev/reference/react/Component#context Context} specified
|
|
953
|
+
* in `contextType`.
|
|
954
|
+
*/
|
|
955
|
+
// TODO: Ideally we'd infer the constructor signatur from `contextType`.
|
|
956
|
+
// Might be hard to ship without breaking existing code.
|
|
957
|
+
constructor(props: P, context: any);
|
|
949
958
|
|
|
950
959
|
// We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
|
|
951
960
|
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
|
|
@@ -1117,7 +1126,14 @@ declare namespace React {
|
|
|
1117
1126
|
*/
|
|
1118
1127
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
|
1119
1128
|
// constructor signature must match React.Component
|
|
1120
|
-
new(
|
|
1129
|
+
new(
|
|
1130
|
+
props: P,
|
|
1131
|
+
/**
|
|
1132
|
+
* Value of the parent {@link https://react.dev/reference/react/Component#context Context} specified
|
|
1133
|
+
* in `contextType`.
|
|
1134
|
+
*/
|
|
1135
|
+
context?: any,
|
|
1136
|
+
): Component<P, S>;
|
|
1121
1137
|
/**
|
|
1122
1138
|
* Ignored by React.
|
|
1123
1139
|
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
|
@@ -1157,7 +1173,7 @@ declare namespace React {
|
|
|
1157
1173
|
*/
|
|
1158
1174
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
|
1159
1175
|
& C
|
|
1160
|
-
& (new(props: P) => T);
|
|
1176
|
+
& (new(props: P, context: any) => T);
|
|
1161
1177
|
|
|
1162
1178
|
//
|
|
1163
1179
|
// Component Specs and Lifecycle
|
|
@@ -1684,20 +1700,6 @@ declare namespace React {
|
|
|
1684
1700
|
reducer: (prevState: S, ...args: A) => S,
|
|
1685
1701
|
initialState: S,
|
|
1686
1702
|
): [S, ActionDispatch<A>];
|
|
1687
|
-
/**
|
|
1688
|
-
* An alternative to `useState`.
|
|
1689
|
-
*
|
|
1690
|
-
* `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
|
1691
|
-
* multiple sub-values. It also lets you optimize performance for components that trigger deep
|
|
1692
|
-
* updates because you can pass `dispatch` down instead of callbacks.
|
|
1693
|
-
*
|
|
1694
|
-
* @version 16.8.0
|
|
1695
|
-
* @see {@link https://react.dev/reference/react/useReducer}
|
|
1696
|
-
*/
|
|
1697
|
-
function useReducer<S, A extends AnyActionArg>(
|
|
1698
|
-
reducer: (prevState: S, ...args: A) => S,
|
|
1699
|
-
initialState: S,
|
|
1700
|
-
): [S, ActionDispatch<A>];
|
|
1701
1703
|
/**
|
|
1702
1704
|
* An alternative to `useState`.
|
|
1703
1705
|
*
|
|
@@ -1772,13 +1774,17 @@ declare namespace React {
|
|
|
1772
1774
|
* @see {@link https://react.dev/reference/react/useEffect}
|
|
1773
1775
|
*/
|
|
1774
1776
|
function useEffect(effect: EffectCallback, deps?: DependencyList): void;
|
|
1777
|
+
/**
|
|
1778
|
+
* @see {@link https://react.dev/reference/react/useEffectEvent `useEffectEvent()` documentation}
|
|
1779
|
+
* @version 19.2.0
|
|
1780
|
+
*/
|
|
1781
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
1782
|
+
export function useEffectEvent<T extends Function>(callback: T): T;
|
|
1775
1783
|
// NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T>
|
|
1776
1784
|
/**
|
|
1777
1785
|
* `useImperativeHandle` customizes the instance value that is exposed to parent components when using
|
|
1778
1786
|
* `ref`. As always, imperative code using refs should be avoided in most cases.
|
|
1779
1787
|
*
|
|
1780
|
-
* `useImperativeHandle` should be used with `React.forwardRef`.
|
|
1781
|
-
*
|
|
1782
1788
|
* @version 16.8.0
|
|
1783
1789
|
* @see {@link https://react.dev/reference/react/useImperativeHandle}
|
|
1784
1790
|
*/
|
|
@@ -1938,10 +1944,39 @@ declare namespace React {
|
|
|
1938
1944
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
1939
1945
|
export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
|
|
1940
1946
|
|
|
1947
|
+
export interface CacheSignal {}
|
|
1948
|
+
/**
|
|
1949
|
+
* @version 19.2.0
|
|
1950
|
+
*/
|
|
1951
|
+
export function cacheSignal(): null | CacheSignal;
|
|
1952
|
+
|
|
1953
|
+
export interface ActivityProps {
|
|
1954
|
+
/**
|
|
1955
|
+
* @default "visible"
|
|
1956
|
+
*/
|
|
1957
|
+
mode?:
|
|
1958
|
+
| "hidden"
|
|
1959
|
+
| "visible"
|
|
1960
|
+
| undefined;
|
|
1961
|
+
/**
|
|
1962
|
+
* A name for this Activity boundary for instrumentation purposes.
|
|
1963
|
+
* The name will help identify this boundary in React DevTools.
|
|
1964
|
+
*/
|
|
1965
|
+
name?: string | undefined;
|
|
1966
|
+
children: ReactNode;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
/**
|
|
1970
|
+
* @see {@link https://react.dev/reference/react/Activity `<Activity>` documentation}
|
|
1971
|
+
* @version 19.2.0
|
|
1972
|
+
*/
|
|
1973
|
+
export const Activity: ExoticComponent<ActivityProps>;
|
|
1974
|
+
|
|
1941
1975
|
/**
|
|
1942
1976
|
* Warning: Only available in development builds.
|
|
1943
1977
|
*
|
|
1944
1978
|
* @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs}
|
|
1979
|
+
* @version 19.1.0
|
|
1945
1980
|
*/
|
|
1946
1981
|
function captureOwnerStack(): string | null;
|
|
1947
1982
|
|
|
@@ -2017,6 +2052,10 @@ declare namespace React {
|
|
|
2017
2052
|
target: EventTarget & T;
|
|
2018
2053
|
}
|
|
2019
2054
|
|
|
2055
|
+
interface InputEvent<T = Element> extends SyntheticEvent<T, NativeInputEvent> {
|
|
2056
|
+
data: string;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2020
2059
|
export type ModifierKey =
|
|
2021
2060
|
| "Alt"
|
|
2022
2061
|
| "AltGraph"
|
|
@@ -2137,6 +2176,7 @@ declare namespace React {
|
|
|
2137
2176
|
type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
|
|
2138
2177
|
type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
|
|
2139
2178
|
type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
|
|
2179
|
+
type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
|
|
2140
2180
|
type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
|
|
2141
2181
|
type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
|
|
2142
2182
|
type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
|
|
@@ -2195,7 +2235,7 @@ declare namespace React {
|
|
|
2195
2235
|
// Form Events
|
|
2196
2236
|
onChange?: FormEventHandler<T> | undefined;
|
|
2197
2237
|
onChangeCapture?: FormEventHandler<T> | undefined;
|
|
2198
|
-
onBeforeInput?:
|
|
2238
|
+
onBeforeInput?: InputEventHandler<T> | undefined;
|
|
2199
2239
|
onBeforeInputCapture?: FormEventHandler<T> | undefined;
|
|
2200
2240
|
onInput?: FormEventHandler<T> | undefined;
|
|
2201
2241
|
onInputCapture?: FormEventHandler<T> | undefined;
|
|
@@ -2253,8 +2293,6 @@ declare namespace React {
|
|
|
2253
2293
|
onProgressCapture?: ReactEventHandler<T> | undefined;
|
|
2254
2294
|
onRateChange?: ReactEventHandler<T> | undefined;
|
|
2255
2295
|
onRateChangeCapture?: ReactEventHandler<T> | undefined;
|
|
2256
|
-
onResize?: ReactEventHandler<T> | undefined;
|
|
2257
|
-
onResizeCapture?: ReactEventHandler<T> | undefined;
|
|
2258
2296
|
onSeeked?: ReactEventHandler<T> | undefined;
|
|
2259
2297
|
onSeekedCapture?: ReactEventHandler<T> | undefined;
|
|
2260
2298
|
onSeeking?: ReactEventHandler<T> | undefined;
|
|
@@ -2744,7 +2782,7 @@ declare namespace React {
|
|
|
2744
2782
|
unselectable?: "on" | "off" | undefined;
|
|
2745
2783
|
|
|
2746
2784
|
// Popover API
|
|
2747
|
-
popover?: "" | "auto" | "manual" | undefined;
|
|
2785
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined;
|
|
2748
2786
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
2749
2787
|
popoverTarget?: string | undefined;
|
|
2750
2788
|
|
|
@@ -2998,6 +3036,7 @@ declare namespace React {
|
|
|
2998
3036
|
}
|
|
2999
3037
|
|
|
3000
3038
|
interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3039
|
+
closedby?: "any" | "closerequest" | "none" | undefined;
|
|
3001
3040
|
onCancel?: ReactEventHandler<T> | undefined;
|
|
3002
3041
|
onClose?: ReactEventHandler<T> | undefined;
|
|
3003
3042
|
open?: boolean | undefined;
|
|
@@ -3235,6 +3274,7 @@ declare namespace React {
|
|
|
3235
3274
|
|
|
3236
3275
|
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3237
3276
|
as?: string | undefined;
|
|
3277
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3238
3278
|
crossOrigin?: CrossOrigin;
|
|
3239
3279
|
fetchPriority?: "high" | "low" | "auto";
|
|
3240
3280
|
href?: string | undefined;
|
|
@@ -3354,10 +3394,12 @@ declare namespace React {
|
|
|
3354
3394
|
|
|
3355
3395
|
interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3356
3396
|
async?: boolean | undefined;
|
|
3397
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3357
3398
|
/** @deprecated */
|
|
3358
3399
|
charSet?: string | undefined;
|
|
3359
3400
|
crossOrigin?: CrossOrigin;
|
|
3360
3401
|
defer?: boolean | undefined;
|
|
3402
|
+
fetchPriority?: "high" | "low" | "auto" | undefined;
|
|
3361
3403
|
integrity?: string | undefined;
|
|
3362
3404
|
noModule?: boolean | undefined;
|
|
3363
3405
|
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
@@ -3388,6 +3430,7 @@ declare namespace React {
|
|
|
3388
3430
|
}
|
|
3389
3431
|
|
|
3390
3432
|
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3433
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3391
3434
|
media?: string | undefined;
|
|
3392
3435
|
scoped?: boolean | undefined;
|
|
3393
3436
|
type?: string | undefined;
|
|
@@ -3468,6 +3511,9 @@ declare namespace React {
|
|
|
3468
3511
|
width?: number | string | undefined;
|
|
3469
3512
|
disablePictureInPicture?: boolean | undefined;
|
|
3470
3513
|
disableRemotePlayback?: boolean | undefined;
|
|
3514
|
+
|
|
3515
|
+
onResize?: ReactEventHandler<T> | undefined;
|
|
3516
|
+
onResizeCapture?: ReactEventHandler<T> | undefined;
|
|
3471
3517
|
}
|
|
3472
3518
|
|
|
3473
3519
|
// this list is "complete" in that it contains every SVG attribute
|
|
@@ -3561,7 +3607,21 @@ declare namespace React {
|
|
|
3561
3607
|
direction?: number | string | undefined;
|
|
3562
3608
|
display?: number | string | undefined;
|
|
3563
3609
|
divisor?: number | string | undefined;
|
|
3564
|
-
dominantBaseline?:
|
|
3610
|
+
dominantBaseline?:
|
|
3611
|
+
| "auto"
|
|
3612
|
+
| "use-script"
|
|
3613
|
+
| "no-change"
|
|
3614
|
+
| "reset-size"
|
|
3615
|
+
| "ideographic"
|
|
3616
|
+
| "alphabetic"
|
|
3617
|
+
| "hanging"
|
|
3618
|
+
| "mathematical"
|
|
3619
|
+
| "central"
|
|
3620
|
+
| "middle"
|
|
3621
|
+
| "text-after-edge"
|
|
3622
|
+
| "text-before-edge"
|
|
3623
|
+
| "inherit"
|
|
3624
|
+
| undefined;
|
|
3565
3625
|
dur?: number | string | undefined;
|
|
3566
3626
|
dx?: number | string | undefined;
|
|
3567
3627
|
dy?: number | string | undefined;
|
|
@@ -3708,7 +3768,7 @@ declare namespace React {
|
|
|
3708
3768
|
tableValues?: number | string | undefined;
|
|
3709
3769
|
targetX?: number | string | undefined;
|
|
3710
3770
|
targetY?: number | string | undefined;
|
|
3711
|
-
textAnchor?:
|
|
3771
|
+
textAnchor?: "start" | "middle" | "end" | "inherit" | undefined;
|
|
3712
3772
|
textDecoration?: number | string | undefined;
|
|
3713
3773
|
textLength?: number | string | undefined;
|
|
3714
3774
|
textRendering?: number | string | undefined;
|
react/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/react",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.2.4",
|
|
4
4
|
"description": "TypeScript definitions for react",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
|
|
6
6
|
"license": "MIT",
|
|
@@ -205,6 +205,6 @@
|
|
|
205
205
|
"csstype": "^3.0.2"
|
|
206
206
|
},
|
|
207
207
|
"peerDependencies": {},
|
|
208
|
-
"typesPublisherContentHash": "
|
|
209
|
-
"typeScriptVersion": "5.
|
|
208
|
+
"typesPublisherContentHash": "beb6cb0d4cea447e7c02796fed7809694045a85f63ccee65d1eafe9a3ce86b6f",
|
|
209
|
+
"typeScriptVersion": "5.2"
|
|
210
210
|
}
|