@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/react",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.2.1",
|
|
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": "7232140fde6d2a47deb1498773132be00e6f7eee4400a4c8fdfa6da8582b5b08",
|
|
209
|
+
"typeScriptVersion": "5.2"
|
|
210
210
|
}
|
react/ts5.0/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/ts5.0/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/ts5.0/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
|
) => ReactElement<any, any> | null)
|
|
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) => ReactElement | null)
|
|
222
223
|
| keyof JSX.IntrinsicElements,
|
|
223
224
|
> = ComponentRef<C>;
|
|
@@ -722,6 +723,10 @@ declare namespace React {
|
|
|
722
723
|
only<C>(children: C): C extends any[] ? never : C;
|
|
723
724
|
toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>;
|
|
724
725
|
};
|
|
726
|
+
|
|
727
|
+
export interface FragmentProps {
|
|
728
|
+
children?: React.ReactNode;
|
|
729
|
+
}
|
|
725
730
|
/**
|
|
726
731
|
* Lets you group elements without a wrapper node.
|
|
727
732
|
*
|
|
@@ -749,7 +754,7 @@ declare namespace React {
|
|
|
749
754
|
* </>
|
|
750
755
|
* ```
|
|
751
756
|
*/
|
|
752
|
-
const Fragment: ExoticComponent<
|
|
757
|
+
const Fragment: ExoticComponent<FragmentProps>;
|
|
753
758
|
|
|
754
759
|
/**
|
|
755
760
|
* Lets you find common bugs in your components early during development.
|
|
@@ -924,7 +929,7 @@ declare namespace React {
|
|
|
924
929
|
static propTypes?: any;
|
|
925
930
|
|
|
926
931
|
/**
|
|
927
|
-
* If using
|
|
932
|
+
* If using React Context, re-declare this in your class to be the
|
|
928
933
|
* `React.ContextType` of your `static contextType`.
|
|
929
934
|
* Should be used with type annotation or static contextType.
|
|
930
935
|
*
|
|
@@ -943,6 +948,14 @@ declare namespace React {
|
|
|
943
948
|
|
|
944
949
|
// Keep in sync with constructor signature of JSXElementConstructor and ComponentClass.
|
|
945
950
|
constructor(props: P);
|
|
951
|
+
/**
|
|
952
|
+
* @param props
|
|
953
|
+
* @param context value of the parent {@link https://react.dev/reference/react/Component#context Context} specified
|
|
954
|
+
* in `contextType`.
|
|
955
|
+
*/
|
|
956
|
+
// TODO: Ideally we'd infer the constructor signatur from `contextType`.
|
|
957
|
+
// Might be hard to ship without breaking existing code.
|
|
958
|
+
constructor(props: P, context: any);
|
|
946
959
|
|
|
947
960
|
// We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
|
|
948
961
|
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
|
|
@@ -1112,7 +1125,14 @@ declare namespace React {
|
|
|
1112
1125
|
*/
|
|
1113
1126
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
|
1114
1127
|
// constructor signature must match React.Component
|
|
1115
|
-
new(
|
|
1128
|
+
new(
|
|
1129
|
+
props: P,
|
|
1130
|
+
/**
|
|
1131
|
+
* Value of the parent {@link https://react.dev/reference/react/Component#context Context} specified
|
|
1132
|
+
* in `contextType`.
|
|
1133
|
+
*/
|
|
1134
|
+
context?: any,
|
|
1135
|
+
): Component<P, S>;
|
|
1116
1136
|
/**
|
|
1117
1137
|
* Ignored by React.
|
|
1118
1138
|
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
|
@@ -1152,7 +1172,7 @@ declare namespace React {
|
|
|
1152
1172
|
*/
|
|
1153
1173
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
|
1154
1174
|
& C
|
|
1155
|
-
& (new(props: P) => T);
|
|
1175
|
+
& (new(props: P, context: any) => T);
|
|
1156
1176
|
|
|
1157
1177
|
//
|
|
1158
1178
|
// Component Specs and Lifecycle
|
|
@@ -1176,7 +1196,7 @@ declare namespace React {
|
|
|
1176
1196
|
* If false is returned, {@link Component.render}, `componentWillUpdate`
|
|
1177
1197
|
* and `componentDidUpdate` will not be called.
|
|
1178
1198
|
*/
|
|
1179
|
-
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S
|
|
1199
|
+
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean;
|
|
1180
1200
|
/**
|
|
1181
1201
|
* Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
|
|
1182
1202
|
* cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`.
|
|
@@ -1275,7 +1295,7 @@ declare namespace React {
|
|
|
1275
1295
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
|
|
1276
1296
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
|
1277
1297
|
*/
|
|
1278
|
-
componentWillReceiveProps?(nextProps: Readonly<P
|
|
1298
|
+
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
|
1279
1299
|
/**
|
|
1280
1300
|
* Called when the component may be receiving new props.
|
|
1281
1301
|
* React may call this even if props have not changed, so be sure to compare new and existing
|
|
@@ -1293,7 +1313,7 @@ declare namespace React {
|
|
|
1293
1313
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
|
|
1294
1314
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
|
1295
1315
|
*/
|
|
1296
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P
|
|
1316
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
|
1297
1317
|
/**
|
|
1298
1318
|
* Called immediately before rendering when new props or state is received. Not called for the initial render.
|
|
1299
1319
|
*
|
|
@@ -1307,7 +1327,7 @@ declare namespace React {
|
|
|
1307
1327
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
|
|
1308
1328
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
|
1309
1329
|
*/
|
|
1310
|
-
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S
|
|
1330
|
+
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
|
1311
1331
|
/**
|
|
1312
1332
|
* Called immediately before rendering when new props or state is received. Not called for the initial render.
|
|
1313
1333
|
*
|
|
@@ -1323,7 +1343,7 @@ declare namespace React {
|
|
|
1323
1343
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
|
|
1324
1344
|
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
|
1325
1345
|
*/
|
|
1326
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S
|
|
1346
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
|
1327
1347
|
}
|
|
1328
1348
|
|
|
1329
1349
|
function createRef<T>(): RefObject<T | null>;
|
|
@@ -1507,13 +1527,13 @@ declare namespace React {
|
|
|
1507
1527
|
* @example
|
|
1508
1528
|
*
|
|
1509
1529
|
* ```tsx
|
|
1510
|
-
* type MyComponentRef = React.
|
|
1530
|
+
* type MyComponentRef = React.ComponentRef<typeof MyComponent>;
|
|
1511
1531
|
* ```
|
|
1512
1532
|
*
|
|
1513
1533
|
* @example
|
|
1514
1534
|
*
|
|
1515
1535
|
* ```tsx
|
|
1516
|
-
* type DivRef = React.
|
|
1536
|
+
* type DivRef = React.ComponentRef<'div'>;
|
|
1517
1537
|
* ```
|
|
1518
1538
|
*/
|
|
1519
1539
|
type ComponentRef<T extends ElementType> = ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
|
|
@@ -1679,20 +1699,6 @@ declare namespace React {
|
|
|
1679
1699
|
reducer: (prevState: S, ...args: A) => S,
|
|
1680
1700
|
initialState: S,
|
|
1681
1701
|
): [S, ActionDispatch<A>];
|
|
1682
|
-
/**
|
|
1683
|
-
* An alternative to `useState`.
|
|
1684
|
-
*
|
|
1685
|
-
* `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
|
1686
|
-
* multiple sub-values. It also lets you optimize performance for components that trigger deep
|
|
1687
|
-
* updates because you can pass `dispatch` down instead of callbacks.
|
|
1688
|
-
*
|
|
1689
|
-
* @version 16.8.0
|
|
1690
|
-
* @see {@link https://react.dev/reference/react/useReducer}
|
|
1691
|
-
*/
|
|
1692
|
-
function useReducer<S, A extends AnyActionArg>(
|
|
1693
|
-
reducer: (prevState: S, ...args: A) => S,
|
|
1694
|
-
initialState: S,
|
|
1695
|
-
): [S, ActionDispatch<A>];
|
|
1696
1702
|
/**
|
|
1697
1703
|
* An alternative to `useState`.
|
|
1698
1704
|
*
|
|
@@ -1767,13 +1773,17 @@ declare namespace React {
|
|
|
1767
1773
|
* @see {@link https://react.dev/reference/react/useEffect}
|
|
1768
1774
|
*/
|
|
1769
1775
|
function useEffect(effect: EffectCallback, deps?: DependencyList): void;
|
|
1776
|
+
/**
|
|
1777
|
+
* @see {@link https://react.dev/reference/react/useEffectEvent `useEffectEvent()` documentation}
|
|
1778
|
+
* @version 19.2.0
|
|
1779
|
+
*/
|
|
1780
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
1781
|
+
export function useEffectEvent<T extends Function>(callback: T): T;
|
|
1770
1782
|
// NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T>
|
|
1771
1783
|
/**
|
|
1772
1784
|
* `useImperativeHandle` customizes the instance value that is exposed to parent components when using
|
|
1773
1785
|
* `ref`. As always, imperative code using refs should be avoided in most cases.
|
|
1774
1786
|
*
|
|
1775
|
-
* `useImperativeHandle` should be used with `React.forwardRef`.
|
|
1776
|
-
*
|
|
1777
1787
|
* @version 16.8.0
|
|
1778
1788
|
* @see {@link https://react.dev/reference/react/useImperativeHandle}
|
|
1779
1789
|
*/
|
|
@@ -1834,10 +1844,11 @@ declare namespace React {
|
|
|
1834
1844
|
* A good example of this is a text input.
|
|
1835
1845
|
*
|
|
1836
1846
|
* @param value The value that is going to be deferred
|
|
1847
|
+
* @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.
|
|
1837
1848
|
*
|
|
1838
1849
|
* @see {@link https://react.dev/reference/react/useDeferredValue}
|
|
1839
1850
|
*/
|
|
1840
|
-
export function useDeferredValue<T>(value: T): T;
|
|
1851
|
+
export function useDeferredValue<T>(value: T, initialValue?: T): T;
|
|
1841
1852
|
|
|
1842
1853
|
/**
|
|
1843
1854
|
* Allows components to avoid undesirable loading states by waiting for content to load
|
|
@@ -1862,7 +1873,6 @@ declare namespace React {
|
|
|
1862
1873
|
* @param callback A function which causes state updates that can be deferred.
|
|
1863
1874
|
*/
|
|
1864
1875
|
export function startTransition(scope: TransitionFunction): void;
|
|
1865
|
-
export function startTransition(scope: TransitionFunction): void;
|
|
1866
1876
|
|
|
1867
1877
|
/**
|
|
1868
1878
|
* Wrap any code rendering and triggering updates to your components into `act()` calls.
|
|
@@ -1933,6 +1943,42 @@ declare namespace React {
|
|
|
1933
1943
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
1934
1944
|
export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
|
|
1935
1945
|
|
|
1946
|
+
export interface CacheSignal {}
|
|
1947
|
+
/**
|
|
1948
|
+
* @version 19.2.0
|
|
1949
|
+
*/
|
|
1950
|
+
export function cacheSignal(): null | CacheSignal;
|
|
1951
|
+
|
|
1952
|
+
export interface ActivityProps {
|
|
1953
|
+
/**
|
|
1954
|
+
* @default "visible"
|
|
1955
|
+
*/
|
|
1956
|
+
mode?:
|
|
1957
|
+
| "hidden"
|
|
1958
|
+
| "visible"
|
|
1959
|
+
| undefined;
|
|
1960
|
+
/**
|
|
1961
|
+
* A name for this Activity boundary for instrumentation purposes.
|
|
1962
|
+
* The name will help identify this boundary in React DevTools.
|
|
1963
|
+
*/
|
|
1964
|
+
name?: string | undefined;
|
|
1965
|
+
children: ReactNode;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
/**
|
|
1969
|
+
* @see {@link https://react.dev/reference/react/Activity `<Activity>` documentation}
|
|
1970
|
+
* @version 19.2.0
|
|
1971
|
+
*/
|
|
1972
|
+
export const Activity: ExoticComponent<ActivityProps>;
|
|
1973
|
+
|
|
1974
|
+
/**
|
|
1975
|
+
* Warning: Only available in development builds.
|
|
1976
|
+
*
|
|
1977
|
+
* @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs}
|
|
1978
|
+
* @version 19.1.0
|
|
1979
|
+
*/
|
|
1980
|
+
function captureOwnerStack(): string | null;
|
|
1981
|
+
|
|
1936
1982
|
//
|
|
1937
1983
|
// Event System
|
|
1938
1984
|
// ----------------------------------------------------------------------
|
|
@@ -2005,6 +2051,10 @@ declare namespace React {
|
|
|
2005
2051
|
target: EventTarget & T;
|
|
2006
2052
|
}
|
|
2007
2053
|
|
|
2054
|
+
interface InputEvent<T = Element> extends SyntheticEvent<T, NativeInputEvent> {
|
|
2055
|
+
data: string;
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2008
2058
|
export type ModifierKey =
|
|
2009
2059
|
| "Alt"
|
|
2010
2060
|
| "AltGraph"
|
|
@@ -2125,6 +2175,7 @@ declare namespace React {
|
|
|
2125
2175
|
type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
|
|
2126
2176
|
type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
|
|
2127
2177
|
type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
|
|
2178
|
+
type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
|
|
2128
2179
|
type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
|
|
2129
2180
|
type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
|
|
2130
2181
|
type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
|
|
@@ -2183,7 +2234,7 @@ declare namespace React {
|
|
|
2183
2234
|
// Form Events
|
|
2184
2235
|
onChange?: FormEventHandler<T> | undefined;
|
|
2185
2236
|
onChangeCapture?: FormEventHandler<T> | undefined;
|
|
2186
|
-
onBeforeInput?:
|
|
2237
|
+
onBeforeInput?: InputEventHandler<T> | undefined;
|
|
2187
2238
|
onBeforeInputCapture?: FormEventHandler<T> | undefined;
|
|
2188
2239
|
onInput?: FormEventHandler<T> | undefined;
|
|
2189
2240
|
onInputCapture?: FormEventHandler<T> | undefined;
|
|
@@ -2241,8 +2292,6 @@ declare namespace React {
|
|
|
2241
2292
|
onProgressCapture?: ReactEventHandler<T> | undefined;
|
|
2242
2293
|
onRateChange?: ReactEventHandler<T> | undefined;
|
|
2243
2294
|
onRateChangeCapture?: ReactEventHandler<T> | undefined;
|
|
2244
|
-
onResize?: ReactEventHandler<T> | undefined;
|
|
2245
|
-
onResizeCapture?: ReactEventHandler<T> | undefined;
|
|
2246
2295
|
onSeeked?: ReactEventHandler<T> | undefined;
|
|
2247
2296
|
onSeekedCapture?: ReactEventHandler<T> | undefined;
|
|
2248
2297
|
onSeeking?: ReactEventHandler<T> | undefined;
|
|
@@ -2333,6 +2382,8 @@ declare namespace React {
|
|
|
2333
2382
|
// UI Events
|
|
2334
2383
|
onScroll?: UIEventHandler<T> | undefined;
|
|
2335
2384
|
onScrollCapture?: UIEventHandler<T> | undefined;
|
|
2385
|
+
onScrollEnd?: UIEventHandler<T> | undefined;
|
|
2386
|
+
onScrollEndCapture?: UIEventHandler<T> | undefined;
|
|
2336
2387
|
|
|
2337
2388
|
// Wheel Events
|
|
2338
2389
|
onWheel?: WheelEventHandler<T> | undefined;
|
|
@@ -2730,7 +2781,7 @@ declare namespace React {
|
|
|
2730
2781
|
unselectable?: "on" | "off" | undefined;
|
|
2731
2782
|
|
|
2732
2783
|
// Popover API
|
|
2733
|
-
popover?: "" | "auto" | "manual" | undefined;
|
|
2784
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined;
|
|
2734
2785
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
2735
2786
|
popoverTarget?: string | undefined;
|
|
2736
2787
|
|
|
@@ -2749,6 +2800,14 @@ declare namespace React {
|
|
|
2749
2800
|
* @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is}
|
|
2750
2801
|
*/
|
|
2751
2802
|
is?: string | undefined;
|
|
2803
|
+
/**
|
|
2804
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts}
|
|
2805
|
+
*/
|
|
2806
|
+
exportparts?: string | undefined;
|
|
2807
|
+
/**
|
|
2808
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part}
|
|
2809
|
+
*/
|
|
2810
|
+
part?: string | undefined;
|
|
2752
2811
|
}
|
|
2753
2812
|
|
|
2754
2813
|
/**
|
|
@@ -2976,6 +3035,7 @@ declare namespace React {
|
|
|
2976
3035
|
}
|
|
2977
3036
|
|
|
2978
3037
|
interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3038
|
+
closedby?: "any" | "closerequest" | "none" | undefined;
|
|
2979
3039
|
onCancel?: ReactEventHandler<T> | undefined;
|
|
2980
3040
|
onClose?: ReactEventHandler<T> | undefined;
|
|
2981
3041
|
open?: boolean | undefined;
|
|
@@ -3038,6 +3098,8 @@ declare namespace React {
|
|
|
3038
3098
|
width?: number | string | undefined;
|
|
3039
3099
|
}
|
|
3040
3100
|
|
|
3101
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {}
|
|
3102
|
+
|
|
3041
3103
|
interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3042
3104
|
alt?: string | undefined;
|
|
3043
3105
|
crossOrigin?: CrossOrigin;
|
|
@@ -3047,7 +3109,12 @@ declare namespace React {
|
|
|
3047
3109
|
loading?: "eager" | "lazy" | undefined;
|
|
3048
3110
|
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
3049
3111
|
sizes?: string | undefined;
|
|
3050
|
-
src?:
|
|
3112
|
+
src?:
|
|
3113
|
+
| string
|
|
3114
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES[
|
|
3115
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES
|
|
3116
|
+
]
|
|
3117
|
+
| undefined;
|
|
3051
3118
|
srcSet?: string | undefined;
|
|
3052
3119
|
useMap?: string | undefined;
|
|
3053
3120
|
width?: number | string | undefined;
|
|
@@ -3206,6 +3273,7 @@ declare namespace React {
|
|
|
3206
3273
|
|
|
3207
3274
|
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3208
3275
|
as?: string | undefined;
|
|
3276
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3209
3277
|
crossOrigin?: CrossOrigin;
|
|
3210
3278
|
fetchPriority?: "high" | "low" | "auto";
|
|
3211
3279
|
href?: string | undefined;
|
|
@@ -3231,6 +3299,8 @@ declare namespace React {
|
|
|
3231
3299
|
type?: string | undefined;
|
|
3232
3300
|
}
|
|
3233
3301
|
|
|
3302
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES {}
|
|
3303
|
+
|
|
3234
3304
|
interface MediaHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3235
3305
|
autoPlay?: boolean | undefined;
|
|
3236
3306
|
controls?: boolean | undefined;
|
|
@@ -3241,7 +3311,12 @@ declare namespace React {
|
|
|
3241
3311
|
muted?: boolean | undefined;
|
|
3242
3312
|
playsInline?: boolean | undefined;
|
|
3243
3313
|
preload?: string | undefined;
|
|
3244
|
-
src?:
|
|
3314
|
+
src?:
|
|
3315
|
+
| string
|
|
3316
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES[
|
|
3317
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES
|
|
3318
|
+
]
|
|
3319
|
+
| undefined;
|
|
3245
3320
|
}
|
|
3246
3321
|
|
|
3247
3322
|
interface MetaHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
@@ -3318,10 +3393,12 @@ declare namespace React {
|
|
|
3318
3393
|
|
|
3319
3394
|
interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3320
3395
|
async?: boolean | undefined;
|
|
3396
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3321
3397
|
/** @deprecated */
|
|
3322
3398
|
charSet?: string | undefined;
|
|
3323
3399
|
crossOrigin?: CrossOrigin;
|
|
3324
3400
|
defer?: boolean | undefined;
|
|
3401
|
+
fetchPriority?: "high" | "low" | "auto" | undefined;
|
|
3325
3402
|
integrity?: string | undefined;
|
|
3326
3403
|
noModule?: boolean | undefined;
|
|
3327
3404
|
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
@@ -3352,6 +3429,7 @@ declare namespace React {
|
|
|
3352
3429
|
}
|
|
3353
3430
|
|
|
3354
3431
|
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3432
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3355
3433
|
media?: string | undefined;
|
|
3356
3434
|
scoped?: boolean | undefined;
|
|
3357
3435
|
type?: string | undefined;
|
|
@@ -3432,6 +3510,9 @@ declare namespace React {
|
|
|
3432
3510
|
width?: number | string | undefined;
|
|
3433
3511
|
disablePictureInPicture?: boolean | undefined;
|
|
3434
3512
|
disableRemotePlayback?: boolean | undefined;
|
|
3513
|
+
|
|
3514
|
+
onResize?: ReactEventHandler<T> | undefined;
|
|
3515
|
+
onResizeCapture?: ReactEventHandler<T> | undefined;
|
|
3435
3516
|
}
|
|
3436
3517
|
|
|
3437
3518
|
// this list is "complete" in that it contains every SVG attribute
|
|
@@ -3525,7 +3606,21 @@ declare namespace React {
|
|
|
3525
3606
|
direction?: number | string | undefined;
|
|
3526
3607
|
display?: number | string | undefined;
|
|
3527
3608
|
divisor?: number | string | undefined;
|
|
3528
|
-
dominantBaseline?:
|
|
3609
|
+
dominantBaseline?:
|
|
3610
|
+
| "auto"
|
|
3611
|
+
| "use-script"
|
|
3612
|
+
| "no-change"
|
|
3613
|
+
| "reset-size"
|
|
3614
|
+
| "ideographic"
|
|
3615
|
+
| "alphabetic"
|
|
3616
|
+
| "hanging"
|
|
3617
|
+
| "mathematical"
|
|
3618
|
+
| "central"
|
|
3619
|
+
| "middle"
|
|
3620
|
+
| "text-after-edge"
|
|
3621
|
+
| "text-before-edge"
|
|
3622
|
+
| "inherit"
|
|
3623
|
+
| undefined;
|
|
3529
3624
|
dur?: number | string | undefined;
|
|
3530
3625
|
dx?: number | string | undefined;
|
|
3531
3626
|
dy?: number | string | undefined;
|
|
@@ -3672,7 +3767,7 @@ declare namespace React {
|
|
|
3672
3767
|
tableValues?: number | string | undefined;
|
|
3673
3768
|
targetX?: number | string | undefined;
|
|
3674
3769
|
targetY?: number | string | undefined;
|
|
3675
|
-
textAnchor?:
|
|
3770
|
+
textAnchor?: "start" | "middle" | "end" | "inherit" | undefined;
|
|
3676
3771
|
textDecoration?: number | string | undefined;
|
|
3677
3772
|
textLength?: number | string | undefined;
|
|
3678
3773
|
textRendering?: number | string | undefined;
|