@types/react 19.1.2 → 19.2.7
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 +112 -29
- react/package.json +4 -4
- 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 +112 -29
- 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/ts5.0/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/ts5.0/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/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 {}
|
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>;
|
|
@@ -928,7 +929,7 @@ declare namespace React {
|
|
|
928
929
|
static propTypes?: any;
|
|
929
930
|
|
|
930
931
|
/**
|
|
931
|
-
* If using
|
|
932
|
+
* If using React Context, re-declare this in your class to be the
|
|
932
933
|
* `React.ContextType` of your `static contextType`.
|
|
933
934
|
* Should be used with type annotation or static contextType.
|
|
934
935
|
*
|
|
@@ -947,6 +948,14 @@ declare namespace React {
|
|
|
947
948
|
|
|
948
949
|
// Keep in sync with constructor signature of JSXElementConstructor and ComponentClass.
|
|
949
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);
|
|
950
959
|
|
|
951
960
|
// We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
|
|
952
961
|
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
|
|
@@ -1116,7 +1125,14 @@ declare namespace React {
|
|
|
1116
1125
|
*/
|
|
1117
1126
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
|
1118
1127
|
// constructor signature must match React.Component
|
|
1119
|
-
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>;
|
|
1120
1136
|
/**
|
|
1121
1137
|
* Ignored by React.
|
|
1122
1138
|
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
|
@@ -1156,7 +1172,7 @@ declare namespace React {
|
|
|
1156
1172
|
*/
|
|
1157
1173
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
|
1158
1174
|
& C
|
|
1159
|
-
& (new(props: P) => T);
|
|
1175
|
+
& (new(props: P, context: any) => T);
|
|
1160
1176
|
|
|
1161
1177
|
//
|
|
1162
1178
|
// Component Specs and Lifecycle
|
|
@@ -1683,20 +1699,6 @@ declare namespace React {
|
|
|
1683
1699
|
reducer: (prevState: S, ...args: A) => S,
|
|
1684
1700
|
initialState: S,
|
|
1685
1701
|
): [S, ActionDispatch<A>];
|
|
1686
|
-
/**
|
|
1687
|
-
* An alternative to `useState`.
|
|
1688
|
-
*
|
|
1689
|
-
* `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
|
1690
|
-
* multiple sub-values. It also lets you optimize performance for components that trigger deep
|
|
1691
|
-
* updates because you can pass `dispatch` down instead of callbacks.
|
|
1692
|
-
*
|
|
1693
|
-
* @version 16.8.0
|
|
1694
|
-
* @see {@link https://react.dev/reference/react/useReducer}
|
|
1695
|
-
*/
|
|
1696
|
-
function useReducer<S, A extends AnyActionArg>(
|
|
1697
|
-
reducer: (prevState: S, ...args: A) => S,
|
|
1698
|
-
initialState: S,
|
|
1699
|
-
): [S, ActionDispatch<A>];
|
|
1700
1702
|
/**
|
|
1701
1703
|
* An alternative to `useState`.
|
|
1702
1704
|
*
|
|
@@ -1771,13 +1773,17 @@ declare namespace React {
|
|
|
1771
1773
|
* @see {@link https://react.dev/reference/react/useEffect}
|
|
1772
1774
|
*/
|
|
1773
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;
|
|
1774
1782
|
// NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T>
|
|
1775
1783
|
/**
|
|
1776
1784
|
* `useImperativeHandle` customizes the instance value that is exposed to parent components when using
|
|
1777
1785
|
* `ref`. As always, imperative code using refs should be avoided in most cases.
|
|
1778
1786
|
*
|
|
1779
|
-
* `useImperativeHandle` should be used with `React.forwardRef`.
|
|
1780
|
-
*
|
|
1781
1787
|
* @version 16.8.0
|
|
1782
1788
|
* @see {@link https://react.dev/reference/react/useImperativeHandle}
|
|
1783
1789
|
*/
|
|
@@ -1919,7 +1925,31 @@ declare namespace React {
|
|
|
1919
1925
|
reducer: (state: State, action: Action) => State,
|
|
1920
1926
|
): [State, (action: Action) => void];
|
|
1921
1927
|
|
|
1922
|
-
|
|
1928
|
+
interface UntrackedReactPromise<T> extends PromiseLike<T> {
|
|
1929
|
+
status?: void;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
export interface PendingReactPromise<T> extends PromiseLike<T> {
|
|
1933
|
+
status: "pending";
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
export interface FulfilledReactPromise<T> extends PromiseLike<T> {
|
|
1937
|
+
status: "fulfilled";
|
|
1938
|
+
value: T;
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
export interface RejectedReactPromise<T> extends PromiseLike<T> {
|
|
1942
|
+
status: "rejected";
|
|
1943
|
+
reason: unknown;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
export type ReactPromise<T> =
|
|
1947
|
+
| UntrackedReactPromise<T>
|
|
1948
|
+
| PendingReactPromise<T>
|
|
1949
|
+
| FulfilledReactPromise<T>
|
|
1950
|
+
| RejectedReactPromise<T>;
|
|
1951
|
+
|
|
1952
|
+
export type Usable<T> = ReactPromise<T> | Context<T>;
|
|
1923
1953
|
|
|
1924
1954
|
export function use<T>(usable: Usable<T>): T;
|
|
1925
1955
|
|
|
@@ -1937,10 +1967,39 @@ declare namespace React {
|
|
|
1937
1967
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
1938
1968
|
export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
|
|
1939
1969
|
|
|
1970
|
+
export interface CacheSignal {}
|
|
1971
|
+
/**
|
|
1972
|
+
* @version 19.2.0
|
|
1973
|
+
*/
|
|
1974
|
+
export function cacheSignal(): null | CacheSignal;
|
|
1975
|
+
|
|
1976
|
+
export interface ActivityProps {
|
|
1977
|
+
/**
|
|
1978
|
+
* @default "visible"
|
|
1979
|
+
*/
|
|
1980
|
+
mode?:
|
|
1981
|
+
| "hidden"
|
|
1982
|
+
| "visible"
|
|
1983
|
+
| undefined;
|
|
1984
|
+
/**
|
|
1985
|
+
* A name for this Activity boundary for instrumentation purposes.
|
|
1986
|
+
* The name will help identify this boundary in React DevTools.
|
|
1987
|
+
*/
|
|
1988
|
+
name?: string | undefined;
|
|
1989
|
+
children: ReactNode;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
/**
|
|
1993
|
+
* @see {@link https://react.dev/reference/react/Activity `<Activity>` documentation}
|
|
1994
|
+
* @version 19.2.0
|
|
1995
|
+
*/
|
|
1996
|
+
export const Activity: ExoticComponent<ActivityProps>;
|
|
1997
|
+
|
|
1940
1998
|
/**
|
|
1941
1999
|
* Warning: Only available in development builds.
|
|
1942
2000
|
*
|
|
1943
2001
|
* @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs}
|
|
2002
|
+
* @version 19.1.0
|
|
1944
2003
|
*/
|
|
1945
2004
|
function captureOwnerStack(): string | null;
|
|
1946
2005
|
|
|
@@ -2016,6 +2075,10 @@ declare namespace React {
|
|
|
2016
2075
|
target: EventTarget & T;
|
|
2017
2076
|
}
|
|
2018
2077
|
|
|
2078
|
+
interface InputEvent<T = Element> extends SyntheticEvent<T, NativeInputEvent> {
|
|
2079
|
+
data: string;
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2019
2082
|
export type ModifierKey =
|
|
2020
2083
|
| "Alt"
|
|
2021
2084
|
| "AltGraph"
|
|
@@ -2136,6 +2199,7 @@ declare namespace React {
|
|
|
2136
2199
|
type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
|
|
2137
2200
|
type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
|
|
2138
2201
|
type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
|
|
2202
|
+
type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
|
|
2139
2203
|
type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
|
|
2140
2204
|
type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
|
|
2141
2205
|
type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
|
|
@@ -2194,7 +2258,7 @@ declare namespace React {
|
|
|
2194
2258
|
// Form Events
|
|
2195
2259
|
onChange?: FormEventHandler<T> | undefined;
|
|
2196
2260
|
onChangeCapture?: FormEventHandler<T> | undefined;
|
|
2197
|
-
onBeforeInput?:
|
|
2261
|
+
onBeforeInput?: InputEventHandler<T> | undefined;
|
|
2198
2262
|
onBeforeInputCapture?: FormEventHandler<T> | undefined;
|
|
2199
2263
|
onInput?: FormEventHandler<T> | undefined;
|
|
2200
2264
|
onInputCapture?: FormEventHandler<T> | undefined;
|
|
@@ -2252,8 +2316,6 @@ declare namespace React {
|
|
|
2252
2316
|
onProgressCapture?: ReactEventHandler<T> | undefined;
|
|
2253
2317
|
onRateChange?: ReactEventHandler<T> | undefined;
|
|
2254
2318
|
onRateChangeCapture?: ReactEventHandler<T> | undefined;
|
|
2255
|
-
onResize?: ReactEventHandler<T> | undefined;
|
|
2256
|
-
onResizeCapture?: ReactEventHandler<T> | undefined;
|
|
2257
2319
|
onSeeked?: ReactEventHandler<T> | undefined;
|
|
2258
2320
|
onSeekedCapture?: ReactEventHandler<T> | undefined;
|
|
2259
2321
|
onSeeking?: ReactEventHandler<T> | undefined;
|
|
@@ -2743,7 +2805,7 @@ declare namespace React {
|
|
|
2743
2805
|
unselectable?: "on" | "off" | undefined;
|
|
2744
2806
|
|
|
2745
2807
|
// Popover API
|
|
2746
|
-
popover?: "" | "auto" | "manual" | undefined;
|
|
2808
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined;
|
|
2747
2809
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
2748
2810
|
popoverTarget?: string | undefined;
|
|
2749
2811
|
|
|
@@ -2997,6 +3059,7 @@ declare namespace React {
|
|
|
2997
3059
|
}
|
|
2998
3060
|
|
|
2999
3061
|
interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3062
|
+
closedby?: "any" | "closerequest" | "none" | undefined;
|
|
3000
3063
|
onCancel?: ReactEventHandler<T> | undefined;
|
|
3001
3064
|
onClose?: ReactEventHandler<T> | undefined;
|
|
3002
3065
|
open?: boolean | undefined;
|
|
@@ -3234,6 +3297,7 @@ declare namespace React {
|
|
|
3234
3297
|
|
|
3235
3298
|
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3236
3299
|
as?: string | undefined;
|
|
3300
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3237
3301
|
crossOrigin?: CrossOrigin;
|
|
3238
3302
|
fetchPriority?: "high" | "low" | "auto";
|
|
3239
3303
|
href?: string | undefined;
|
|
@@ -3353,10 +3417,12 @@ declare namespace React {
|
|
|
3353
3417
|
|
|
3354
3418
|
interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3355
3419
|
async?: boolean | undefined;
|
|
3420
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3356
3421
|
/** @deprecated */
|
|
3357
3422
|
charSet?: string | undefined;
|
|
3358
3423
|
crossOrigin?: CrossOrigin;
|
|
3359
3424
|
defer?: boolean | undefined;
|
|
3425
|
+
fetchPriority?: "high" | "low" | "auto" | undefined;
|
|
3360
3426
|
integrity?: string | undefined;
|
|
3361
3427
|
noModule?: boolean | undefined;
|
|
3362
3428
|
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
@@ -3387,6 +3453,7 @@ declare namespace React {
|
|
|
3387
3453
|
}
|
|
3388
3454
|
|
|
3389
3455
|
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3456
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3390
3457
|
media?: string | undefined;
|
|
3391
3458
|
scoped?: boolean | undefined;
|
|
3392
3459
|
type?: string | undefined;
|
|
@@ -3467,6 +3534,9 @@ declare namespace React {
|
|
|
3467
3534
|
width?: number | string | undefined;
|
|
3468
3535
|
disablePictureInPicture?: boolean | undefined;
|
|
3469
3536
|
disableRemotePlayback?: boolean | undefined;
|
|
3537
|
+
|
|
3538
|
+
onResize?: ReactEventHandler<T> | undefined;
|
|
3539
|
+
onResizeCapture?: ReactEventHandler<T> | undefined;
|
|
3470
3540
|
}
|
|
3471
3541
|
|
|
3472
3542
|
// this list is "complete" in that it contains every SVG attribute
|
|
@@ -3560,7 +3630,21 @@ declare namespace React {
|
|
|
3560
3630
|
direction?: number | string | undefined;
|
|
3561
3631
|
display?: number | string | undefined;
|
|
3562
3632
|
divisor?: number | string | undefined;
|
|
3563
|
-
dominantBaseline?:
|
|
3633
|
+
dominantBaseline?:
|
|
3634
|
+
| "auto"
|
|
3635
|
+
| "use-script"
|
|
3636
|
+
| "no-change"
|
|
3637
|
+
| "reset-size"
|
|
3638
|
+
| "ideographic"
|
|
3639
|
+
| "alphabetic"
|
|
3640
|
+
| "hanging"
|
|
3641
|
+
| "mathematical"
|
|
3642
|
+
| "central"
|
|
3643
|
+
| "middle"
|
|
3644
|
+
| "text-after-edge"
|
|
3645
|
+
| "text-before-edge"
|
|
3646
|
+
| "inherit"
|
|
3647
|
+
| undefined;
|
|
3564
3648
|
dur?: number | string | undefined;
|
|
3565
3649
|
dx?: number | string | undefined;
|
|
3566
3650
|
dy?: number | string | undefined;
|
|
@@ -3707,7 +3791,7 @@ declare namespace React {
|
|
|
3707
3791
|
tableValues?: number | string | undefined;
|
|
3708
3792
|
targetX?: number | string | undefined;
|
|
3709
3793
|
targetY?: number | string | undefined;
|
|
3710
|
-
textAnchor?:
|
|
3794
|
+
textAnchor?: "start" | "middle" | "end" | "inherit" | undefined;
|
|
3711
3795
|
textDecoration?: number | string | undefined;
|
|
3712
3796
|
textLength?: number | string | undefined;
|
|
3713
3797
|
textRendering?: number | string | undefined;
|
|
@@ -3996,7 +4080,6 @@ declare namespace React {
|
|
|
3996
4080
|
* Captures which component contained the exception, and its ancestors.
|
|
3997
4081
|
*/
|
|
3998
4082
|
componentStack?: string | null;
|
|
3999
|
-
digest?: string | null;
|
|
4000
4083
|
}
|
|
4001
4084
|
|
|
4002
4085
|
// Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts
|