@types/react 19.1.2 → 19.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- react/README.md +1 -1
- react/canary.d.ts +85 -0
- react/experimental.d.ts +17 -111
- react/global.d.ts +1 -0
- react/index.d.ts +87 -27
- react/package.json +3 -3
- react/ts5.0/canary.d.ts +85 -0
- react/ts5.0/experimental.d.ts +17 -111
- react/ts5.0/global.d.ts +1 -0
- react/ts5.0/index.d.ts +87 -27
- react/ts5.0/v18/global.d.ts +0 -160
- react/ts5.0/v18/index.d.ts +0 -4543
- react/ts5.0/v18/jsx-dev-runtime.d.ts +0 -45
- react/ts5.0/v18/jsx-runtime.d.ts +0 -36
- react/ts5.0/v18/ts5.0/global.d.ts +0 -160
- react/ts5.0/v18/ts5.0/index.d.ts +0 -4530
- react/ts5.0/v18/ts5.0/jsx-dev-runtime.d.ts +0 -44
- react/ts5.0/v18/ts5.0/jsx-runtime.d.ts +0 -35
react/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
|
*/
|
|
@@ -1937,10 +1943,39 @@ declare namespace React {
|
|
|
1937
1943
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
1938
1944
|
export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
|
|
1939
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
|
+
|
|
1940
1974
|
/**
|
|
1941
1975
|
* Warning: Only available in development builds.
|
|
1942
1976
|
*
|
|
1943
1977
|
* @see {@link https://react.dev/reference/react/captureOwnerStack Reference docs}
|
|
1978
|
+
* @version 19.1.0
|
|
1944
1979
|
*/
|
|
1945
1980
|
function captureOwnerStack(): string | null;
|
|
1946
1981
|
|
|
@@ -2016,6 +2051,10 @@ declare namespace React {
|
|
|
2016
2051
|
target: EventTarget & T;
|
|
2017
2052
|
}
|
|
2018
2053
|
|
|
2054
|
+
interface InputEvent<T = Element> extends SyntheticEvent<T, NativeInputEvent> {
|
|
2055
|
+
data: string;
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2019
2058
|
export type ModifierKey =
|
|
2020
2059
|
| "Alt"
|
|
2021
2060
|
| "AltGraph"
|
|
@@ -2136,6 +2175,7 @@ declare namespace React {
|
|
|
2136
2175
|
type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
|
|
2137
2176
|
type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
|
|
2138
2177
|
type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
|
|
2178
|
+
type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
|
|
2139
2179
|
type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
|
|
2140
2180
|
type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
|
|
2141
2181
|
type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
|
|
@@ -2194,7 +2234,7 @@ declare namespace React {
|
|
|
2194
2234
|
// Form Events
|
|
2195
2235
|
onChange?: FormEventHandler<T> | undefined;
|
|
2196
2236
|
onChangeCapture?: FormEventHandler<T> | undefined;
|
|
2197
|
-
onBeforeInput?:
|
|
2237
|
+
onBeforeInput?: InputEventHandler<T> | undefined;
|
|
2198
2238
|
onBeforeInputCapture?: FormEventHandler<T> | undefined;
|
|
2199
2239
|
onInput?: FormEventHandler<T> | undefined;
|
|
2200
2240
|
onInputCapture?: FormEventHandler<T> | undefined;
|
|
@@ -2252,8 +2292,6 @@ declare namespace React {
|
|
|
2252
2292
|
onProgressCapture?: ReactEventHandler<T> | undefined;
|
|
2253
2293
|
onRateChange?: ReactEventHandler<T> | undefined;
|
|
2254
2294
|
onRateChangeCapture?: ReactEventHandler<T> | undefined;
|
|
2255
|
-
onResize?: ReactEventHandler<T> | undefined;
|
|
2256
|
-
onResizeCapture?: ReactEventHandler<T> | undefined;
|
|
2257
2295
|
onSeeked?: ReactEventHandler<T> | undefined;
|
|
2258
2296
|
onSeekedCapture?: ReactEventHandler<T> | undefined;
|
|
2259
2297
|
onSeeking?: ReactEventHandler<T> | undefined;
|
|
@@ -2743,7 +2781,7 @@ declare namespace React {
|
|
|
2743
2781
|
unselectable?: "on" | "off" | undefined;
|
|
2744
2782
|
|
|
2745
2783
|
// Popover API
|
|
2746
|
-
popover?: "" | "auto" | "manual" | undefined;
|
|
2784
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined;
|
|
2747
2785
|
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
2748
2786
|
popoverTarget?: string | undefined;
|
|
2749
2787
|
|
|
@@ -2997,6 +3035,7 @@ declare namespace React {
|
|
|
2997
3035
|
}
|
|
2998
3036
|
|
|
2999
3037
|
interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3038
|
+
closedby?: "any" | "closerequest" | "none" | undefined;
|
|
3000
3039
|
onCancel?: ReactEventHandler<T> | undefined;
|
|
3001
3040
|
onClose?: ReactEventHandler<T> | undefined;
|
|
3002
3041
|
open?: boolean | undefined;
|
|
@@ -3234,6 +3273,7 @@ declare namespace React {
|
|
|
3234
3273
|
|
|
3235
3274
|
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3236
3275
|
as?: string | undefined;
|
|
3276
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3237
3277
|
crossOrigin?: CrossOrigin;
|
|
3238
3278
|
fetchPriority?: "high" | "low" | "auto";
|
|
3239
3279
|
href?: string | undefined;
|
|
@@ -3353,10 +3393,12 @@ declare namespace React {
|
|
|
3353
3393
|
|
|
3354
3394
|
interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3355
3395
|
async?: boolean | undefined;
|
|
3396
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3356
3397
|
/** @deprecated */
|
|
3357
3398
|
charSet?: string | undefined;
|
|
3358
3399
|
crossOrigin?: CrossOrigin;
|
|
3359
3400
|
defer?: boolean | undefined;
|
|
3401
|
+
fetchPriority?: "high" | "low" | "auto" | undefined;
|
|
3360
3402
|
integrity?: string | undefined;
|
|
3361
3403
|
noModule?: boolean | undefined;
|
|
3362
3404
|
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
@@ -3387,6 +3429,7 @@ declare namespace React {
|
|
|
3387
3429
|
}
|
|
3388
3430
|
|
|
3389
3431
|
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
3432
|
+
blocking?: "render" | (string & {}) | undefined;
|
|
3390
3433
|
media?: string | undefined;
|
|
3391
3434
|
scoped?: boolean | undefined;
|
|
3392
3435
|
type?: string | undefined;
|
|
@@ -3467,6 +3510,9 @@ declare namespace React {
|
|
|
3467
3510
|
width?: number | string | undefined;
|
|
3468
3511
|
disablePictureInPicture?: boolean | undefined;
|
|
3469
3512
|
disableRemotePlayback?: boolean | undefined;
|
|
3513
|
+
|
|
3514
|
+
onResize?: ReactEventHandler<T> | undefined;
|
|
3515
|
+
onResizeCapture?: ReactEventHandler<T> | undefined;
|
|
3470
3516
|
}
|
|
3471
3517
|
|
|
3472
3518
|
// this list is "complete" in that it contains every SVG attribute
|
|
@@ -3560,7 +3606,21 @@ declare namespace React {
|
|
|
3560
3606
|
direction?: number | string | undefined;
|
|
3561
3607
|
display?: number | string | undefined;
|
|
3562
3608
|
divisor?: number | string | undefined;
|
|
3563
|
-
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;
|
|
3564
3624
|
dur?: number | string | undefined;
|
|
3565
3625
|
dx?: number | string | undefined;
|
|
3566
3626
|
dy?: number | string | undefined;
|
|
@@ -3707,7 +3767,7 @@ declare namespace React {
|
|
|
3707
3767
|
tableValues?: number | string | undefined;
|
|
3708
3768
|
targetX?: number | string | undefined;
|
|
3709
3769
|
targetY?: number | string | undefined;
|
|
3710
|
-
textAnchor?:
|
|
3770
|
+
textAnchor?: "start" | "middle" | "end" | "inherit" | undefined;
|
|
3711
3771
|
textDecoration?: number | string | undefined;
|
|
3712
3772
|
textLength?: number | string | undefined;
|
|
3713
3773
|
textRendering?: number | string | undefined;
|