@types/react 19.0.0 → 19.2.1
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/experimental.d.ts +119 -19
- react/global.d.ts +5 -0
- react/index.d.ts +136 -41
- react/package.json +3 -3
- react/ts5.0/experimental.d.ts +119 -19
- react/ts5.0/global.d.ts +5 -0
- react/ts5.0/index.d.ts +134 -39
- 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: Mon, 06 Oct 2025 21:02:40 GMT
|
|
12
12
|
* Dependencies: [csstype](https://npmjs.com/package/csstype)
|
|
13
13
|
|
|
14
14
|
# Credits
|
react/experimental.d.ts
CHANGED
|
@@ -51,10 +51,13 @@ declare module "." {
|
|
|
51
51
|
unstable_expectedLoadTime?: number | undefined;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export type SuspenseListRevealOrder = "forwards" | "backwards" | "together";
|
|
55
|
-
export type SuspenseListTailMode = "collapsed" | "hidden";
|
|
54
|
+
export type SuspenseListRevealOrder = "forwards" | "backwards" | "together" | "independent";
|
|
55
|
+
export type SuspenseListTailMode = "collapsed" | "hidden" | "visible";
|
|
56
56
|
|
|
57
57
|
export interface SuspenseListCommonProps {
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
|
|
58
61
|
/**
|
|
59
62
|
* Note that SuspenseList require more than one child;
|
|
60
63
|
* it is a runtime warning to provide only a single child.
|
|
@@ -62,33 +65,32 @@ declare module "." {
|
|
|
62
65
|
* It does, however, allow those children to be wrapped inside a single
|
|
63
66
|
* level of `<React.Fragment>`.
|
|
64
67
|
*/
|
|
65
|
-
children: ReactElement |
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
|
|
68
|
+
children: Iterable<ReactElement> | AsyncIterable<ReactElement>;
|
|
69
69
|
/**
|
|
70
70
|
* Defines the order in which the `SuspenseList` children should be revealed.
|
|
71
71
|
*/
|
|
72
|
-
revealOrder: "forwards" | "backwards";
|
|
72
|
+
revealOrder: "forwards" | "backwards" | "unstable_legacy-backwards";
|
|
73
73
|
/**
|
|
74
74
|
* Dictates how unloaded items in a SuspenseList is shown.
|
|
75
75
|
*
|
|
76
76
|
* - By default, `SuspenseList` will show all fallbacks in the list.
|
|
77
77
|
* - `collapsed` shows only the next fallback in the list.
|
|
78
|
-
* - `hidden` doesn
|
|
78
|
+
* - `hidden` doesn't show any unloaded items.
|
|
79
|
+
* - `visible` shows all fallbacks in the list.
|
|
79
80
|
*/
|
|
80
|
-
tail
|
|
81
|
+
tail: SuspenseListTailMode;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
|
|
85
|
+
children: ReactNode;
|
|
84
86
|
/**
|
|
85
87
|
* Defines the order in which the `SuspenseList` children should be revealed.
|
|
86
88
|
*/
|
|
87
|
-
revealOrder
|
|
89
|
+
revealOrder: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps["revealOrder"]> | undefined;
|
|
88
90
|
/**
|
|
89
91
|
* The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
|
|
90
92
|
*/
|
|
91
|
-
tail?: never
|
|
93
|
+
tail?: never;
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
|
|
@@ -106,14 +108,6 @@ declare module "." {
|
|
|
106
108
|
*/
|
|
107
109
|
export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
|
|
108
110
|
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
110
|
-
export function experimental_useEffectEvent<T extends Function>(event: T): T;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Warning: Only available in development builds.
|
|
114
|
-
*/
|
|
115
|
-
function captureOwnerStack(): string | null;
|
|
116
|
-
|
|
117
111
|
type Reference = object;
|
|
118
112
|
type TaintableUniqueValue = string | bigint | ArrayBufferView;
|
|
119
113
|
function experimental_taintUniqueValue(
|
|
@@ -122,4 +116,110 @@ declare module "." {
|
|
|
122
116
|
value: TaintableUniqueValue,
|
|
123
117
|
): void;
|
|
124
118
|
function experimental_taintObjectReference(message: string | undefined, object: Reference): void;
|
|
119
|
+
|
|
120
|
+
export interface ViewTransitionInstance {
|
|
121
|
+
/**
|
|
122
|
+
* The {@link ViewTransitionProps name} that was used in the corresponding {@link ViewTransition} component or `"auto"` if the `name` prop was omitted.
|
|
123
|
+
*/
|
|
124
|
+
name: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export type ViewTransitionClassPerType = Record<"default" | (string & {}), "none" | "auto" | (string & {})>;
|
|
128
|
+
export type ViewTransitionClass = ViewTransitionClassPerType | ViewTransitionClassPerType[string];
|
|
129
|
+
|
|
130
|
+
export interface ViewTransitionProps {
|
|
131
|
+
children?: ReactNode | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Assigns the {@link https://developer.chrome.com/blog/view-transitions-update-io24#view-transition-class `view-transition-class`} class to the underlying DOM node.
|
|
134
|
+
*/
|
|
135
|
+
default?: ViewTransitionClass | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* Combined with {@link className} if this `<ViewTransition>` or its parent Component is mounted and there's no other with the same name being deleted.
|
|
138
|
+
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
139
|
+
*/
|
|
140
|
+
enter?: ViewTransitionClass | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Combined with {@link className} if this `<ViewTransition>` or its parent Component is unmounted and there's no other with the same name being deleted.
|
|
143
|
+
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
144
|
+
*/
|
|
145
|
+
exit?: ViewTransitionClass | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* "auto" will automatically assign a view-transition-name to the inner DOM node.
|
|
148
|
+
* That way you can add a View Transition to a Component without controlling its DOM nodes styling otherwise.
|
|
149
|
+
*
|
|
150
|
+
* 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.
|
|
151
|
+
* @default "auto"
|
|
152
|
+
*/
|
|
153
|
+
name?: "auto" | (string & {}) | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* The `<ViewTransition>` or its parent Component is mounted and there's no other `<ViewTransition>` with the same name being deleted.
|
|
156
|
+
*/
|
|
157
|
+
onEnter?: (instance: ViewTransitionInstance, types: Array<string>) => void;
|
|
158
|
+
/**
|
|
159
|
+
* The `<ViewTransition>` or its parent Component is unmounted and there's no other `<ViewTransition>` with the same name being deleted.
|
|
160
|
+
*/
|
|
161
|
+
onExit?: (instance: ViewTransitionInstance, types: Array<string>) => void;
|
|
162
|
+
/**
|
|
163
|
+
* This `<ViewTransition>` is being mounted and another `<ViewTransition>` instance with the same name is being unmounted elsewhere.
|
|
164
|
+
*/
|
|
165
|
+
onShare?: (instance: ViewTransitionInstance, types: Array<string>) => void;
|
|
166
|
+
/**
|
|
167
|
+
* The content of `<ViewTransition>` has changed either due to DOM mutations or because an inner child `<ViewTransition>` has resized.
|
|
168
|
+
*/
|
|
169
|
+
onUpdate?: (instance: ViewTransitionInstance, types: Array<string>) => void;
|
|
170
|
+
ref?: Ref<ViewTransitionInstance> | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Combined with {@link className} if this `<ViewTransition>` is being mounted and another instance with the same name is being unmounted elsewhere.
|
|
173
|
+
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
174
|
+
*/
|
|
175
|
+
share?: ViewTransitionClass | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* Combined with {@link className} if the content of this `<ViewTransition>` has changed either due to DOM mutations or because an inner child has resized.
|
|
178
|
+
* `"none"` is a special value that deactivates the view transition name under that condition.
|
|
179
|
+
*/
|
|
180
|
+
update?: ViewTransitionClass | undefined;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Opt-in for using {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API View Transitions} in React.
|
|
185
|
+
* View Transitions only trigger for async updates like {@link startTransition}, {@link useDeferredValue}, Actions or <{@link Suspense}> revealing from fallback to content.
|
|
186
|
+
* Synchronous updates provide an opt-out but also guarantee that they commit immediately which View Transitions can't.
|
|
187
|
+
*
|
|
188
|
+
* @see {@link https://github.com/facebook/react/pull/31975}
|
|
189
|
+
*/
|
|
190
|
+
export const unstable_ViewTransition: ExoticComponent<ViewTransitionProps>;
|
|
191
|
+
|
|
192
|
+
export function unstable_addTransitionType(type: string): void;
|
|
193
|
+
|
|
194
|
+
// @enableGestureTransition
|
|
195
|
+
// Implemented by the specific renderer e.g. `react-dom`.
|
|
196
|
+
// Keep in mind that augmented interfaces merge their JSDoc so if you put
|
|
197
|
+
// JSDoc here and in the renderer, the IDE will display both.
|
|
198
|
+
export interface GestureProvider {}
|
|
199
|
+
export interface GestureOptions {
|
|
200
|
+
rangeStart?: number | undefined;
|
|
201
|
+
rangeEnd?: number | undefined;
|
|
202
|
+
}
|
|
203
|
+
/** */
|
|
204
|
+
export function unstable_startGestureTransition(
|
|
205
|
+
provider: GestureProvider,
|
|
206
|
+
scope: () => void,
|
|
207
|
+
options?: GestureOptions,
|
|
208
|
+
): () => void;
|
|
209
|
+
|
|
210
|
+
// @enableFragmentRefs
|
|
211
|
+
export interface FragmentInstance {}
|
|
212
|
+
|
|
213
|
+
export interface FragmentProps {
|
|
214
|
+
ref?: Ref<FragmentInstance> | undefined;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// @enableSrcObject
|
|
218
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {
|
|
219
|
+
srcObject: Blob;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES {
|
|
223
|
+
srcObject: Blob | MediaSource | MediaStream;
|
|
224
|
+
}
|
|
125
225
|
}
|
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 {}
|
|
@@ -158,3 +159,7 @@ interface WebGLRenderingContext {}
|
|
|
158
159
|
interface WebGL2RenderingContext {}
|
|
159
160
|
|
|
160
161
|
interface TrustedHTML {}
|
|
162
|
+
|
|
163
|
+
interface Blob {}
|
|
164
|
+
interface MediaStream {}
|
|
165
|
+
interface MediaSource {}
|
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;
|
|
@@ -132,9 +133,9 @@ declare namespace React {
|
|
|
132
133
|
type JSXElementConstructor<P> =
|
|
133
134
|
| ((
|
|
134
135
|
props: P,
|
|
135
|
-
) => ReactNode)
|
|
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>;
|
|
@@ -721,6 +722,10 @@ declare namespace React {
|
|
|
721
722
|
only<C>(children: C): C extends any[] ? never : C;
|
|
722
723
|
toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>;
|
|
723
724
|
};
|
|
725
|
+
|
|
726
|
+
export interface FragmentProps {
|
|
727
|
+
children?: React.ReactNode;
|
|
728
|
+
}
|
|
724
729
|
/**
|
|
725
730
|
* Lets you group elements without a wrapper node.
|
|
726
731
|
*
|
|
@@ -748,7 +753,7 @@ declare namespace React {
|
|
|
748
753
|
* </>
|
|
749
754
|
* ```
|
|
750
755
|
*/
|
|
751
|
-
const Fragment: ExoticComponent<
|
|
756
|
+
const Fragment: ExoticComponent<FragmentProps>;
|
|
752
757
|
|
|
753
758
|
/**
|
|
754
759
|
* Lets you find common bugs in your components early during development.
|
|
@@ -923,7 +928,7 @@ declare namespace React {
|
|
|
923
928
|
static propTypes?: any;
|
|
924
929
|
|
|
925
930
|
/**
|
|
926
|
-
* If using
|
|
931
|
+
* If using React Context, re-declare this in your class to be the
|
|
927
932
|
* `React.ContextType` of your `static contextType`.
|
|
928
933
|
* Should be used with type annotation or static contextType.
|
|
929
934
|
*
|
|
@@ -942,6 +947,14 @@ declare namespace React {
|
|
|
942
947
|
|
|
943
948
|
// Keep in sync with constructor signature of JSXElementConstructor and ComponentClass.
|
|
944
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);
|
|
945
958
|
|
|
946
959
|
// We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
|
|
947
960
|
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
|
|
@@ -1036,7 +1049,7 @@ declare namespace React {
|
|
|
1036
1049
|
* ```
|
|
1037
1050
|
*/
|
|
1038
1051
|
interface FunctionComponent<P = {}> {
|
|
1039
|
-
(props: P): ReactNode
|
|
1052
|
+
(props: P): ReactNode | Promise<ReactNode>;
|
|
1040
1053
|
/**
|
|
1041
1054
|
* Ignored by React.
|
|
1042
1055
|
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
|
@@ -1113,7 +1126,14 @@ declare namespace React {
|
|
|
1113
1126
|
*/
|
|
1114
1127
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
|
1115
1128
|
// constructor signature must match React.Component
|
|
1116
|
-
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>;
|
|
1117
1137
|
/**
|
|
1118
1138
|
* Ignored by React.
|
|
1119
1139
|
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
|
@@ -1153,7 +1173,7 @@ declare namespace React {
|
|
|
1153
1173
|
*/
|
|
1154
1174
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
|
1155
1175
|
& C
|
|
1156
|
-
& (new(props: P) => T);
|
|
1176
|
+
& (new(props: P, context: any) => T);
|
|
1157
1177
|
|
|
1158
1178
|
//
|
|
1159
1179
|
// Component Specs and Lifecycle
|
|
@@ -1177,7 +1197,7 @@ declare namespace React {
|
|
|
1177
1197
|
* If false is returned, {@link Component.render}, `componentWillUpdate`
|
|
1178
1198
|
* and `componentDidUpdate` will not be called.
|
|
1179
1199
|
*/
|
|
1180
|
-
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S
|
|
1200
|
+
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean;
|
|
1181
1201
|
/**
|
|
1182
1202
|
* Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
|
|
1183
1203
|
* cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`.
|
|
@@ -1276,7 +1296,7 @@ declare namespace React {
|
|
|
1276
1296
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
|
|
1277
1297
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
|
1278
1298
|
*/
|
|
1279
|
-
componentWillReceiveProps?(nextProps: Readonly<P
|
|
1299
|
+
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
|
1280
1300
|
/**
|
|
1281
1301
|
* Called when the component may be receiving new props.
|
|
1282
1302
|
* React may call this even if props have not changed, so be sure to compare new and existing
|
|
@@ -1294,7 +1314,7 @@ declare namespace React {
|
|
|
1294
1314
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
|
|
1295
1315
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
|
1296
1316
|
*/
|
|
1297
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P
|
|
1317
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
|
1298
1318
|
/**
|
|
1299
1319
|
* Called immediately before rendering when new props or state is received. Not called for the initial render.
|
|
1300
1320
|
*
|
|
@@ -1308,7 +1328,7 @@ declare namespace React {
|
|
|
1308
1328
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
|
|
1309
1329
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
|
1310
1330
|
*/
|
|
1311
|
-
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S
|
|
1331
|
+
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
|
1312
1332
|
/**
|
|
1313
1333
|
* Called immediately before rendering when new props or state is received. Not called for the initial render.
|
|
1314
1334
|
*
|
|
@@ -1324,7 +1344,7 @@ declare namespace React {
|
|
|
1324
1344
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
|
|
1325
1345
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
|
1326
1346
|
*/
|
|
1327
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S
|
|
1347
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
|
1328
1348
|
}
|
|
1329
1349
|
|
|
1330
1350
|
function createRef<T>(): RefObject<T | null>;
|
|
@@ -1508,13 +1528,13 @@ declare namespace React {
|
|
|
1508
1528
|
* @example
|
|
1509
1529
|
*
|
|
1510
1530
|
* ```tsx
|
|
1511
|
-
* type MyComponentRef = React.
|
|
1531
|
+
* type MyComponentRef = React.ComponentRef<typeof MyComponent>;
|
|
1512
1532
|
* ```
|
|
1513
1533
|
*
|
|
1514
1534
|
* @example
|
|
1515
1535
|
*
|
|
1516
1536
|
* ```tsx
|
|
1517
|
-
* type DivRef = React.
|
|
1537
|
+
* type DivRef = React.ComponentRef<'div'>;
|
|
1518
1538
|
* ```
|
|
1519
1539
|
*/
|
|
1520
1540
|
type ComponentRef<T extends ElementType> = ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
|
|
@@ -1680,20 +1700,6 @@ declare namespace React {
|
|
|
1680
1700
|
reducer: (prevState: S, ...args: A) => S,
|
|
1681
1701
|
initialState: S,
|
|
1682
1702
|
): [S, ActionDispatch<A>];
|
|
1683
|
-
/**
|
|
1684
|
-
* An alternative to `useState`.
|
|
1685
|
-
*
|
|
1686
|
-
* `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
|
1687
|
-
* multiple sub-values. It also lets you optimize performance for components that trigger deep
|
|
1688
|
-
* updates because you can pass `dispatch` down instead of callbacks.
|
|
1689
|
-
*
|
|
1690
|
-
* @version 16.8.0
|
|
1691
|
-
* @see {@link https://react.dev/reference/react/useReducer}
|
|
1692
|
-
*/
|
|
1693
|
-
function useReducer<S, A extends AnyActionArg>(
|
|
1694
|
-
reducer: (prevState: S, ...args: A) => S,
|
|
1695
|
-
initialState: S,
|
|
1696
|
-
): [S, ActionDispatch<A>];
|
|
1697
1703
|
/**
|
|
1698
1704
|
* An alternative to `useState`.
|
|
1699
1705
|
*
|
|
@@ -1768,13 +1774,17 @@ declare namespace React {
|
|
|
1768
1774
|
* @see {@link https://react.dev/reference/react/useEffect}
|
|
1769
1775
|
*/
|
|
1770
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;
|
|
1771
1783
|
// NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T>
|
|
1772
1784
|
/**
|
|
1773
1785
|
* `useImperativeHandle` customizes the instance value that is exposed to parent components when using
|
|
1774
1786
|
* `ref`. As always, imperative code using refs should be avoided in most cases.
|
|
1775
1787
|
*
|
|
1776
|
-
* `useImperativeHandle` should be used with `React.forwardRef`.
|
|
1777
|
-
*
|
|
1778
1788
|
* @version 16.8.0
|
|
1779
1789
|
* @see {@link https://react.dev/reference/react/useImperativeHandle}
|
|
1780
1790
|
*/
|
|
@@ -1835,10 +1845,11 @@ declare namespace React {
|
|
|
1835
1845
|
* A good example of this is a text input.
|
|
1836
1846
|
*
|
|
1837
1847
|
* @param value The value that is going to be deferred
|
|
1848
|
+
* @param initialValue A value to use during the initial render of a component. If this option is omitted, `useDeferredValue` will not defer during the initial render, because there’s no previous version of `value` that it can render instead.
|
|
1838
1849
|
*
|
|
1839
1850
|
* @see {@link https://react.dev/reference/react/useDeferredValue}
|
|
1840
1851
|
*/
|
|
1841
|
-
export function useDeferredValue<T>(value: T): T;
|
|
1852
|
+
export function useDeferredValue<T>(value: T, initialValue?: T): T;
|
|
1842
1853
|
|
|
1843
1854
|
/**
|
|
1844
1855
|
* Allows components to avoid undesirable loading states by waiting for content to load
|
|
@@ -1863,7 +1874,6 @@ declare namespace React {
|
|
|
1863
1874
|
* @param callback A function which causes state updates that can be deferred.
|
|
1864
1875
|
*/
|
|
1865
1876
|
export function startTransition(scope: TransitionFunction): void;
|
|
1866
|
-
export function startTransition(scope: TransitionFunction): void;
|
|
1867
1877
|
|
|
1868
1878
|
/**
|
|
1869
1879
|
* Wrap any code rendering and triggering updates to your components into `act()` calls.
|
|
@@ -1934,6 +1944,42 @@ declare namespace React {
|
|
|
1934
1944
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
1935
1945
|
export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
|
|
1936
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
|
+
|
|
1975
|
+
/**
|
|
1976
|
+
* Warning: Only available in development builds.
|
|
1977
|
+
*
|
|
1978
|
+
* @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs}
|
|
1979
|
+
* @version 19.1.0
|
|
1980
|
+
*/
|
|
1981
|
+
function captureOwnerStack(): string | null;
|
|
1982
|
+
|
|
1937
1983
|
//
|
|
1938
1984
|
// Event System
|
|
1939
1985
|
// ----------------------------------------------------------------------
|
|
@@ -2006,6 +2052,10 @@ declare namespace React {
|
|
|
2006
2052
|
target: EventTarget & T;
|
|
2007
2053
|
}
|
|
2008
2054
|
|
|
2055
|
+
interface InputEvent<T = Element> extends SyntheticEvent<T, NativeInputEvent> {
|
|
2056
|
+
data: string;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2009
2059
|
export type ModifierKey =
|
|
2010
2060
|
| "Alt"
|
|
2011
2061
|
| "AltGraph"
|
|
@@ -2126,6 +2176,7 @@ declare namespace React {
|
|
|
2126
2176
|
type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
|
|
2127
2177
|
type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
|
|
2128
2178
|
type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
|
|
2179
|
+
type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
|
|
2129
2180
|
type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
|
|
2130
2181
|
type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
|
|
2131
2182
|
type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
|
|
@@ -2184,7 +2235,7 @@ declare namespace React {
|
|
|
2184
2235
|
// Form Events
|
|
2185
2236
|
onChange?: FormEventHandler<T> | undefined;
|
|
2186
2237
|
onChangeCapture?: FormEventHandler<T> | undefined;
|
|
2187
|
-
onBeforeInput?:
|
|
2238
|
+
onBeforeInput?: InputEventHandler<T> | undefined;
|
|
2188
2239
|
onBeforeInputCapture?: FormEventHandler<T> | undefined;
|
|
2189
2240
|
onInput?: FormEventHandler<T> | undefined;
|
|
2190
2241
|
onInputCapture?: FormEventHandler<T> | undefined;
|
|
@@ -2242,8 +2293,6 @@ declare namespace React {
|
|
|
2242
2293
|
onProgressCapture?: ReactEventHandler<T> | undefined;
|
|
2243
2294
|
onRateChange?: ReactEventHandler<T> | undefined;
|
|
2244
2295
|
onRateChangeCapture?: ReactEventHandler<T> | undefined;
|
|
2245
|
-
onResize?: ReactEventHandler<T> | undefined;
|
|
2246
|
-
onResizeCapture?: ReactEventHandler<T> | undefined;
|
|
2247
2296
|
onSeeked?: ReactEventHandler<T> | undefined;
|
|
2248
2297
|
onSeekedCapture?: ReactEventHandler<T> | undefined;
|
|
2249
2298
|
onSeeking?: ReactEventHandler<T> | undefined;
|
|
@@ -2334,6 +2383,8 @@ declare namespace React {
|
|
|
2334
2383
|
// UI Events
|
|
2335
2384
|
onScroll?: UIEventHandler<T> | undefined;
|
|
2336
2385
|
onScrollCapture?: UIEventHandler<T> | undefined;
|
|
2386
|
+
onScrollEnd?: UIEventHandler<T> | undefined;
|
|
2387
|
+
onScrollEndCapture?: UIEventHandler<T> | undefined;
|
|
2337
2388
|
|
|
2338
2389
|
// Wheel Events
|
|
2339
2390
|
onWheel?: WheelEventHandler<T> | undefined;
|
|
@@ -2731,7 +2782,7 @@ declare namespace React {
|
|
|
2731
2782
|
unselectable?: "on" | "off" | undefined;
|
|
2732
2783
|
|
|
2733
2784
|
// Popover API
|
|
2734
|
-
popover?: "" | "auto" | "manual" | undefined;
|
|
2785
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined;
|
|
2735
2786
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
2736
2787
|
popoverTarget?: string | undefined;
|
|
2737
2788
|
|
|
@@ -2750,6 +2801,14 @@ declare namespace React {
|
|
|
2750
2801
|
* @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is}
|
|
2751
2802
|
*/
|
|
2752
2803
|
is?: string | undefined;
|
|
2804
|
+
/**
|
|
2805
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts}
|
|
2806
|
+
*/
|
|
2807
|
+
exportparts?: string | undefined;
|
|
2808
|
+
/**
|
|
2809
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part}
|
|
2810
|
+
*/
|
|
2811
|
+
part?: string | undefined;
|
|
2753
2812
|
}
|
|
2754
2813
|
|
|
2755
2814
|
/**
|
|
@@ -2977,6 +3036,7 @@ declare namespace React {
|
|
|
2977
3036
|
}
|
|
2978
3037
|
|
|
2979
3038
|
interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3039
|
+
closedby?: "any" | "closerequest" | "none" | undefined;
|
|
2980
3040
|
onCancel?: ReactEventHandler<T> | undefined;
|
|
2981
3041
|
onClose?: ReactEventHandler<T> | undefined;
|
|
2982
3042
|
open?: boolean | undefined;
|
|
@@ -3039,6 +3099,8 @@ declare namespace React {
|
|
|
3039
3099
|
width?: number | string | undefined;
|
|
3040
3100
|
}
|
|
3041
3101
|
|
|
3102
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {}
|
|
3103
|
+
|
|
3042
3104
|
interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3043
3105
|
alt?: string | undefined;
|
|
3044
3106
|
crossOrigin?: CrossOrigin;
|
|
@@ -3048,7 +3110,12 @@ declare namespace React {
|
|
|
3048
3110
|
loading?: "eager" | "lazy" | undefined;
|
|
3049
3111
|
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
3050
3112
|
sizes?: string | undefined;
|
|
3051
|
-
src?:
|
|
3113
|
+
src?:
|
|
3114
|
+
| string
|
|
3115
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES[
|
|
3116
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES
|
|
3117
|
+
]
|
|
3118
|
+
| undefined;
|
|
3052
3119
|
srcSet?: string | undefined;
|
|
3053
3120
|
useMap?: string | undefined;
|
|
3054
3121
|
width?: number | string | undefined;
|
|
@@ -3207,6 +3274,7 @@ declare namespace React {
|
|
|
3207
3274
|
|
|
3208
3275
|
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3209
3276
|
as?: string | undefined;
|
|
3277
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3210
3278
|
crossOrigin?: CrossOrigin;
|
|
3211
3279
|
fetchPriority?: "high" | "low" | "auto";
|
|
3212
3280
|
href?: string | undefined;
|
|
@@ -3232,6 +3300,8 @@ declare namespace React {
|
|
|
3232
3300
|
type?: string | undefined;
|
|
3233
3301
|
}
|
|
3234
3302
|
|
|
3303
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES {}
|
|
3304
|
+
|
|
3235
3305
|
interface MediaHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3236
3306
|
autoPlay?: boolean | undefined;
|
|
3237
3307
|
controls?: boolean | undefined;
|
|
@@ -3242,7 +3312,12 @@ declare namespace React {
|
|
|
3242
3312
|
muted?: boolean | undefined;
|
|
3243
3313
|
playsInline?: boolean | undefined;
|
|
3244
3314
|
preload?: string | undefined;
|
|
3245
|
-
src?:
|
|
3315
|
+
src?:
|
|
3316
|
+
| string
|
|
3317
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES[
|
|
3318
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES
|
|
3319
|
+
]
|
|
3320
|
+
| undefined;
|
|
3246
3321
|
}
|
|
3247
3322
|
|
|
3248
3323
|
interface MetaHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
@@ -3319,10 +3394,12 @@ declare namespace React {
|
|
|
3319
3394
|
|
|
3320
3395
|
interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3321
3396
|
async?: boolean | undefined;
|
|
3397
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3322
3398
|
/** @deprecated */
|
|
3323
3399
|
charSet?: string | undefined;
|
|
3324
3400
|
crossOrigin?: CrossOrigin;
|
|
3325
3401
|
defer?: boolean | undefined;
|
|
3402
|
+
fetchPriority?: "high" | "low" | "auto" | undefined;
|
|
3326
3403
|
integrity?: string | undefined;
|
|
3327
3404
|
noModule?: boolean | undefined;
|
|
3328
3405
|
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
@@ -3353,6 +3430,7 @@ declare namespace React {
|
|
|
3353
3430
|
}
|
|
3354
3431
|
|
|
3355
3432
|
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3433
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3356
3434
|
media?: string | undefined;
|
|
3357
3435
|
scoped?: boolean | undefined;
|
|
3358
3436
|
type?: string | undefined;
|
|
@@ -3433,6 +3511,9 @@ declare namespace React {
|
|
|
3433
3511
|
width?: number | string | undefined;
|
|
3434
3512
|
disablePictureInPicture?: boolean | undefined;
|
|
3435
3513
|
disableRemotePlayback?: boolean | undefined;
|
|
3514
|
+
|
|
3515
|
+
onResize?: ReactEventHandler<T> | undefined;
|
|
3516
|
+
onResizeCapture?: ReactEventHandler<T> | undefined;
|
|
3436
3517
|
}
|
|
3437
3518
|
|
|
3438
3519
|
// this list is "complete" in that it contains every SVG attribute
|
|
@@ -3526,7 +3607,21 @@ declare namespace React {
|
|
|
3526
3607
|
direction?: number | string | undefined;
|
|
3527
3608
|
display?: number | string | undefined;
|
|
3528
3609
|
divisor?: number | string | undefined;
|
|
3529
|
-
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;
|
|
3530
3625
|
dur?: number | string | undefined;
|
|
3531
3626
|
dx?: number | string | undefined;
|
|
3532
3627
|
dy?: number | string | undefined;
|
|
@@ -3673,7 +3768,7 @@ declare namespace React {
|
|
|
3673
3768
|
tableValues?: number | string | undefined;
|
|
3674
3769
|
targetX?: number | string | undefined;
|
|
3675
3770
|
targetY?: number | string | undefined;
|
|
3676
|
-
textAnchor?:
|
|
3771
|
+
textAnchor?: "start" | "middle" | "end" | "inherit" | undefined;
|
|
3677
3772
|
textDecoration?: number | string | undefined;
|
|
3678
3773
|
textLength?: number | string | undefined;
|
|
3679
3774
|
textRendering?: number | string | undefined;
|