@types/react 18.2.51 → 18.2.52
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/index.d.ts +171 -55
- react/package.json +2 -2
react/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for react (https://react.dev/).
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Sat, 03 Feb 2024 00:50:19 GMT
|
12
12
|
* Dependencies: [@types/prop-types](https://npmjs.com/package/@types/prop-types), [@types/scheduler](https://npmjs.com/package/@types/scheduler), [csstype](https://npmjs.com/package/csstype)
|
13
13
|
|
14
14
|
# Credits
|
react/index.d.ts
CHANGED
@@ -20,11 +20,26 @@ type NativePointerEvent = PointerEvent;
|
|
20
20
|
type NativeTransitionEvent = TransitionEvent;
|
21
21
|
type NativeUIEvent = UIEvent;
|
22
22
|
type NativeWheelEvent = WheelEvent;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Used to represent DOM API's where users can either pass
|
26
|
+
* true or false as a boolean or as its equivalent strings.
|
27
|
+
*/
|
23
28
|
type Booleanish = boolean | "true" | "false";
|
29
|
+
|
30
|
+
/**
|
31
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin MDN}
|
32
|
+
*/
|
24
33
|
type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined;
|
25
34
|
|
26
35
|
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
27
|
-
|
36
|
+
|
37
|
+
/**
|
38
|
+
* The function returned from an effect passed to {@link React.useEffect useEffect},
|
39
|
+
* which can be used to clean up the effect when the component unmounts.
|
40
|
+
*
|
41
|
+
* @see {@link https://react.dev/reference/react/useEffect React Docs}
|
42
|
+
*/
|
28
43
|
type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never };
|
29
44
|
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
30
45
|
|
@@ -37,33 +52,128 @@ declare namespace React {
|
|
37
52
|
// React Elements
|
38
53
|
// ----------------------------------------------------------------------
|
39
54
|
|
55
|
+
/**
|
56
|
+
* Used to retrieve the possible components which accept a given set of props.
|
57
|
+
*
|
58
|
+
* Can be passed no type parameters to get a union of all possible components
|
59
|
+
* and tags.
|
60
|
+
*
|
61
|
+
* Is a superset of {@link ComponentType}.
|
62
|
+
*
|
63
|
+
* @template P The props to match against. If not passed, defaults to any.
|
64
|
+
* @template Tag An optional tag to match against. If not passed, attempts to match against all possible tags.
|
65
|
+
*
|
66
|
+
* @example
|
67
|
+
*
|
68
|
+
* ```tsx
|
69
|
+
* // All components and tags (img, embed etc.)
|
70
|
+
* // which accept `src`
|
71
|
+
* type SrcComponents = ElementType<{ src: any }>;
|
72
|
+
* ```
|
73
|
+
*
|
74
|
+
* @example
|
75
|
+
*
|
76
|
+
* ```tsx
|
77
|
+
* // All components
|
78
|
+
* type AllComponents = ElementType;
|
79
|
+
* ```
|
80
|
+
*
|
81
|
+
* @example
|
82
|
+
*
|
83
|
+
* ```tsx
|
84
|
+
* // All custom components which match `src`, and tags which
|
85
|
+
* // match `src`, narrowed down to just `audio` and `embed`
|
86
|
+
* type SrcComponents = ElementType<{ src: any }, 'audio' | 'embed'>;
|
87
|
+
* ```
|
88
|
+
*/
|
40
89
|
type ElementType<P = any, Tag extends keyof JSX.IntrinsicElements = keyof JSX.IntrinsicElements> =
|
41
90
|
| { [K in Tag]: P extends JSX.IntrinsicElements[K] ? K : never }[Tag]
|
42
91
|
| ComponentType<P>;
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Represents any user-defined component, either as a function component or
|
95
|
+
* a class component.
|
96
|
+
*
|
97
|
+
* @template P The props the component accepts.
|
98
|
+
*
|
99
|
+
* @see {@link ComponentClass}
|
100
|
+
* @see {@link FunctionComponent}
|
101
|
+
*/
|
43
102
|
type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
|
44
103
|
|
45
104
|
type JSXElementConstructor<P> =
|
46
105
|
| ((
|
47
106
|
props: P,
|
48
107
|
/**
|
49
|
-
* @deprecated
|
108
|
+
* @deprecated
|
109
|
+
*
|
110
|
+
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-stateless-function-components React Docs}
|
50
111
|
*/
|
51
112
|
deprecatedLegacyContext?: any,
|
52
113
|
) => ReactNode)
|
53
114
|
| (new(
|
54
115
|
props: P,
|
55
116
|
/**
|
56
|
-
* @deprecated
|
117
|
+
* @deprecated
|
118
|
+
*
|
119
|
+
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs}
|
57
120
|
*/
|
58
121
|
deprecatedLegacyContext?: any,
|
59
122
|
) => Component<any, any>);
|
60
123
|
|
124
|
+
/**
|
125
|
+
* A readonly ref container where {@link current} cannot be mutated.
|
126
|
+
*
|
127
|
+
* Created by {@link createRef}, or {@link useRef} when passed `null`.
|
128
|
+
*
|
129
|
+
* @template T The type of the ref's value.
|
130
|
+
*
|
131
|
+
* @example
|
132
|
+
*
|
133
|
+
* ```tsx
|
134
|
+
* const ref = createRef<HTMLDivElement>();
|
135
|
+
*
|
136
|
+
* ref.current = document.createElement('div'); // Error
|
137
|
+
* ```
|
138
|
+
*/
|
61
139
|
interface RefObject<T> {
|
62
140
|
readonly current: T | null;
|
63
141
|
}
|
64
|
-
|
142
|
+
|
143
|
+
/**
|
144
|
+
* A callback fired whenever the ref's value changes.
|
145
|
+
*
|
146
|
+
* @template T The type of the ref's value.
|
147
|
+
*
|
148
|
+
* @see {@link https://react.dev/reference/react-dom/components/common#ref-callback React Docs}
|
149
|
+
*
|
150
|
+
* @example
|
151
|
+
*
|
152
|
+
* ```tsx
|
153
|
+
* <div ref={(node) => console.log(node)} />
|
154
|
+
* ```
|
155
|
+
*/
|
65
156
|
type RefCallback<T> = { bivarianceHack(instance: T | null): void }["bivarianceHack"];
|
157
|
+
|
158
|
+
/**
|
159
|
+
* A union type of all possible shapes for React refs.
|
160
|
+
*
|
161
|
+
* @see {@link RefCallback}
|
162
|
+
* @see {@link RefObject}
|
163
|
+
*/
|
164
|
+
|
66
165
|
type Ref<T> = RefCallback<T> | RefObject<T> | null;
|
166
|
+
/**
|
167
|
+
* A legacy implementation of refs where you can pass a string to a ref prop.
|
168
|
+
*
|
169
|
+
* @see {@link https://react.dev/reference/react/Component#refs React Docs}
|
170
|
+
*
|
171
|
+
* @example
|
172
|
+
*
|
173
|
+
* ```tsx
|
174
|
+
* <div ref="myRef" />
|
175
|
+
* ```
|
176
|
+
*/
|
67
177
|
type LegacyRef<T> = string | Ref<T>;
|
68
178
|
/**
|
69
179
|
* Gets the instance type for a React element. The instance will be different for various component types:
|
@@ -99,6 +209,11 @@ declare namespace React {
|
|
99
209
|
|
100
210
|
type ComponentState = any;
|
101
211
|
|
212
|
+
/**
|
213
|
+
* A value which uniquely identifies a node among items in an array.
|
214
|
+
*
|
215
|
+
* @see {@link https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key React Docs}
|
216
|
+
*/
|
102
217
|
type Key = string | number | bigint;
|
103
218
|
|
104
219
|
/**
|
@@ -112,7 +227,7 @@ declare namespace React {
|
|
112
227
|
/**
|
113
228
|
* Allows getting a ref to the component instance.
|
114
229
|
* Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
|
115
|
-
* @see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom
|
230
|
+
* @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom}
|
116
231
|
*/
|
117
232
|
ref?: Ref<T> | undefined;
|
118
233
|
}
|
@@ -120,7 +235,7 @@ declare namespace React {
|
|
120
235
|
/**
|
121
236
|
* Allows getting a ref to the component instance.
|
122
237
|
* Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).
|
123
|
-
* @see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom
|
238
|
+
* @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom}
|
124
239
|
*/
|
125
240
|
ref?: LegacyRef<T> | undefined;
|
126
241
|
}
|
@@ -719,7 +834,7 @@ declare namespace React {
|
|
719
834
|
* }
|
720
835
|
* ```
|
721
836
|
*
|
722
|
-
* @see https://react.dev/reference/react/Component#static-contexttype
|
837
|
+
* @see {@link https://react.dev/reference/react/Component#static-contexttype}
|
723
838
|
*/
|
724
839
|
static contextType?: Context<any> | undefined;
|
725
840
|
|
@@ -736,14 +851,14 @@ declare namespace React {
|
|
736
851
|
* declare context: React.ContextType<typeof MyContext>
|
737
852
|
* ```
|
738
853
|
*
|
739
|
-
* @see https://react.dev/reference/react/Component#context
|
854
|
+
* @see {@link https://react.dev/reference/react/Component#context}
|
740
855
|
*/
|
741
856
|
context: unknown;
|
742
857
|
|
743
858
|
constructor(props: Readonly<P> | P);
|
744
859
|
/**
|
745
860
|
* @deprecated
|
746
|
-
* @see https://legacy.reactjs.org/docs/legacy-context.html
|
861
|
+
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html}
|
747
862
|
*/
|
748
863
|
constructor(props: P, context: any);
|
749
864
|
|
@@ -796,9 +911,9 @@ declare namespace React {
|
|
796
911
|
* receive a type argument that represents the props the component
|
797
912
|
* receives.
|
798
913
|
*
|
799
|
-
* @
|
914
|
+
* @template P The props the component accepts.
|
800
915
|
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet}
|
801
|
-
* @alias for {@link
|
916
|
+
* @alias for {@link FunctionComponent}
|
802
917
|
*
|
803
918
|
* @example
|
804
919
|
*
|
@@ -827,7 +942,7 @@ declare namespace React {
|
|
827
942
|
* receive a type argument that represents the props the component
|
828
943
|
* accepts.
|
829
944
|
*
|
830
|
-
* @
|
945
|
+
* @template P The props the component accepts.
|
831
946
|
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet}
|
832
947
|
*
|
833
948
|
* @example
|
@@ -948,8 +1063,8 @@ declare namespace React {
|
|
948
1063
|
* @param props Props passed to the component, if any.
|
949
1064
|
* @param ref A ref forwarded to the component of type {@link ForwardedRef}.
|
950
1065
|
*
|
951
|
-
* @
|
952
|
-
* @
|
1066
|
+
* @template T The type of the forwarded ref.
|
1067
|
+
* @template P The type of the props the component accepts.
|
953
1068
|
*
|
954
1069
|
* @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet}
|
955
1070
|
* @see {@link forwardRef}
|
@@ -986,8 +1101,8 @@ declare namespace React {
|
|
986
1101
|
/**
|
987
1102
|
* Represents a component class in React.
|
988
1103
|
*
|
989
|
-
* @
|
990
|
-
* @
|
1104
|
+
* @template P The props the component accepts.
|
1105
|
+
* @template S The internal state of the component.
|
991
1106
|
*/
|
992
1107
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
993
1108
|
new(props: P, context?: any): Component<P, S>;
|
@@ -1052,7 +1167,8 @@ declare namespace React {
|
|
1052
1167
|
*
|
1053
1168
|
* An intersection type is used to infer multiple type parameters from
|
1054
1169
|
* a single argument, which is useful for many top-level API defs.
|
1055
|
-
* See https://github.com/Microsoft/TypeScript/issues/7234
|
1170
|
+
* See {@link https://github.com/Microsoft/TypeScript/issues/7234 this GitHub issue}
|
1171
|
+
* for more info.
|
1056
1172
|
*/
|
1057
1173
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
1058
1174
|
& C
|
@@ -1144,8 +1260,8 @@ declare namespace React {
|
|
1144
1260
|
* prevents this from being invoked.
|
1145
1261
|
*
|
1146
1262
|
* @deprecated 16.3, use componentDidMount or the constructor instead; will stop working in React 17
|
1147
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
|
1148
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
1263
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state}
|
1264
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1149
1265
|
*/
|
1150
1266
|
componentWillMount?(): void;
|
1151
1267
|
/**
|
@@ -1158,8 +1274,8 @@ declare namespace React {
|
|
1158
1274
|
* prevents this from being invoked.
|
1159
1275
|
*
|
1160
1276
|
* @deprecated 16.3, use componentDidMount or the constructor instead
|
1161
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state
|
1162
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
1277
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state}
|
1278
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1163
1279
|
*/
|
1164
1280
|
UNSAFE_componentWillMount?(): void;
|
1165
1281
|
/**
|
@@ -1173,8 +1289,8 @@ declare namespace React {
|
|
1173
1289
|
* prevents this from being invoked.
|
1174
1290
|
*
|
1175
1291
|
* @deprecated 16.3, use static getDerivedStateFromProps instead; will stop working in React 17
|
1176
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
|
1177
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
1292
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
|
1293
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1178
1294
|
*/
|
1179
1295
|
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
1180
1296
|
/**
|
@@ -1190,8 +1306,8 @@ declare namespace React {
|
|
1190
1306
|
* prevents this from being invoked.
|
1191
1307
|
*
|
1192
1308
|
* @deprecated 16.3, use static getDerivedStateFromProps instead
|
1193
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props
|
1194
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
1309
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props}
|
1310
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1195
1311
|
*/
|
1196
1312
|
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
|
1197
1313
|
/**
|
@@ -1203,8 +1319,8 @@ declare namespace React {
|
|
1203
1319
|
* prevents this from being invoked.
|
1204
1320
|
*
|
1205
1321
|
* @deprecated 16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17
|
1206
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
|
1207
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
1322
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
|
1323
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1208
1324
|
*/
|
1209
1325
|
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
1210
1326
|
/**
|
@@ -1218,8 +1334,8 @@ declare namespace React {
|
|
1218
1334
|
* prevents this from being invoked.
|
1219
1335
|
*
|
1220
1336
|
* @deprecated 16.3, use getSnapshotBeforeUpdate instead
|
1221
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update
|
1222
|
-
* @see https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path
|
1337
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update}
|
1338
|
+
* @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path}
|
1223
1339
|
*/
|
1224
1340
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
|
1225
1341
|
}
|
@@ -1258,7 +1374,7 @@ declare namespace React {
|
|
1258
1374
|
/**
|
1259
1375
|
* The type of the component returned from {@link forwardRef}.
|
1260
1376
|
*
|
1261
|
-
* @
|
1377
|
+
* @template P The props the component accepts, if any.
|
1262
1378
|
*
|
1263
1379
|
* @see {@link ExoticComponent}
|
1264
1380
|
*/
|
@@ -1276,8 +1392,8 @@ declare namespace React {
|
|
1276
1392
|
*
|
1277
1393
|
* @param render See the {@link ForwardRefRenderFunction}.
|
1278
1394
|
*
|
1279
|
-
* @
|
1280
|
-
* @
|
1395
|
+
* @template T The type of the DOM node.
|
1396
|
+
* @template P The props the component accepts, if any.
|
1281
1397
|
*
|
1282
1398
|
* @example
|
1283
1399
|
*
|
@@ -1488,14 +1604,14 @@ declare namespace React {
|
|
1488
1604
|
* context value, as given by the nearest context provider for the given context.
|
1489
1605
|
*
|
1490
1606
|
* @version 16.8.0
|
1491
|
-
* @see https://react.dev/reference/react/useContext
|
1607
|
+
* @see {@link https://react.dev/reference/react/useContext}
|
1492
1608
|
*/
|
1493
1609
|
function useContext<T>(context: Context<T> /*, (not public API) observedBits?: number|boolean */): T;
|
1494
1610
|
/**
|
1495
1611
|
* Returns a stateful value, and a function to update it.
|
1496
1612
|
*
|
1497
1613
|
* @version 16.8.0
|
1498
|
-
* @see https://react.dev/reference/react/useState
|
1614
|
+
* @see {@link https://react.dev/reference/react/useState}
|
1499
1615
|
*/
|
1500
1616
|
function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>];
|
1501
1617
|
// convenience overload when first argument is omitted
|
@@ -1503,7 +1619,7 @@ declare namespace React {
|
|
1503
1619
|
* Returns a stateful value, and a function to update it.
|
1504
1620
|
*
|
1505
1621
|
* @version 16.8.0
|
1506
|
-
* @see https://react.dev/reference/react/useState
|
1622
|
+
* @see {@link https://react.dev/reference/react/useState}
|
1507
1623
|
*/
|
1508
1624
|
function useState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>];
|
1509
1625
|
/**
|
@@ -1514,7 +1630,7 @@ declare namespace React {
|
|
1514
1630
|
* updates because you can pass `dispatch` down instead of callbacks.
|
1515
1631
|
*
|
1516
1632
|
* @version 16.8.0
|
1517
|
-
* @see https://react.dev/reference/react/useReducer
|
1633
|
+
* @see {@link https://react.dev/reference/react/useReducer}
|
1518
1634
|
*/
|
1519
1635
|
// overload where dispatch could accept 0 arguments.
|
1520
1636
|
function useReducer<R extends ReducerWithoutAction<any>, I>(
|
@@ -1530,7 +1646,7 @@ declare namespace React {
|
|
1530
1646
|
* updates because you can pass `dispatch` down instead of callbacks.
|
1531
1647
|
*
|
1532
1648
|
* @version 16.8.0
|
1533
|
-
* @see https://react.dev/reference/react/useReducer
|
1649
|
+
* @see {@link https://react.dev/reference/react/useReducer}
|
1534
1650
|
*/
|
1535
1651
|
// overload where dispatch could accept 0 arguments.
|
1536
1652
|
function useReducer<R extends ReducerWithoutAction<any>>(
|
@@ -1546,7 +1662,7 @@ declare namespace React {
|
|
1546
1662
|
* updates because you can pass `dispatch` down instead of callbacks.
|
1547
1663
|
*
|
1548
1664
|
* @version 16.8.0
|
1549
|
-
* @see https://react.dev/reference/react/useReducer
|
1665
|
+
* @see {@link https://react.dev/reference/react/useReducer}
|
1550
1666
|
*/
|
1551
1667
|
// overload where "I" may be a subset of ReducerState<R>; used to provide autocompletion.
|
1552
1668
|
// If "I" matches ReducerState<R> exactly then the last overload will allow initializer to be omitted.
|
@@ -1564,7 +1680,7 @@ declare namespace React {
|
|
1564
1680
|
* updates because you can pass `dispatch` down instead of callbacks.
|
1565
1681
|
*
|
1566
1682
|
* @version 16.8.0
|
1567
|
-
* @see https://react.dev/reference/react/useReducer
|
1683
|
+
* @see {@link https://react.dev/reference/react/useReducer}
|
1568
1684
|
*/
|
1569
1685
|
// overload for free "I"; all goes as long as initializer converts it into "ReducerState<R>".
|
1570
1686
|
function useReducer<R extends Reducer<any, any>, I>(
|
@@ -1580,7 +1696,7 @@ declare namespace React {
|
|
1580
1696
|
* updates because you can pass `dispatch` down instead of callbacks.
|
1581
1697
|
*
|
1582
1698
|
* @version 16.8.0
|
1583
|
-
* @see https://react.dev/reference/react/useReducer
|
1699
|
+
* @see {@link https://react.dev/reference/react/useReducer}
|
1584
1700
|
*/
|
1585
1701
|
|
1586
1702
|
// I'm not sure if I keep this 2-ary or if I make it (2,3)-ary; it's currently (2,3)-ary.
|
@@ -1605,7 +1721,7 @@ declare namespace React {
|
|
1605
1721
|
* value around similar to how you’d use instance fields in classes.
|
1606
1722
|
*
|
1607
1723
|
* @version 16.8.0
|
1608
|
-
* @see https://react.dev/reference/react/useRef
|
1724
|
+
* @see {@link https://react.dev/reference/react/useRef}
|
1609
1725
|
*/
|
1610
1726
|
function useRef<T>(initialValue: T): MutableRefObject<T>;
|
1611
1727
|
// convenience overload for refs given as a ref prop as they typically start with a null value
|
@@ -1620,7 +1736,7 @@ declare namespace React {
|
|
1620
1736
|
* of the generic argument.
|
1621
1737
|
*
|
1622
1738
|
* @version 16.8.0
|
1623
|
-
* @see https://react.dev/reference/react/useRef
|
1739
|
+
* @see {@link https://react.dev/reference/react/useRef}
|
1624
1740
|
*/
|
1625
1741
|
function useRef<T>(initialValue: T | null): RefObject<T>;
|
1626
1742
|
// convenience overload for potentially undefined initialValue / call with 0 arguments
|
@@ -1633,7 +1749,7 @@ declare namespace React {
|
|
1633
1749
|
* value around similar to how you’d use instance fields in classes.
|
1634
1750
|
*
|
1635
1751
|
* @version 16.8.0
|
1636
|
-
* @see https://react.dev/reference/react/useRef
|
1752
|
+
* @see {@link https://react.dev/reference/react/useRef}
|
1637
1753
|
*/
|
1638
1754
|
function useRef<T = undefined>(): MutableRefObject<T | undefined>;
|
1639
1755
|
/**
|
@@ -1647,7 +1763,7 @@ declare namespace React {
|
|
1647
1763
|
* `componentDidMount` and `componentDidUpdate`.
|
1648
1764
|
*
|
1649
1765
|
* @version 16.8.0
|
1650
|
-
* @see https://react.dev/reference/react/useLayoutEffect
|
1766
|
+
* @see {@link https://react.dev/reference/react/useLayoutEffect}
|
1651
1767
|
*/
|
1652
1768
|
function useLayoutEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1653
1769
|
/**
|
@@ -1657,7 +1773,7 @@ declare namespace React {
|
|
1657
1773
|
* @param deps If present, effect will only activate if the values in the list change.
|
1658
1774
|
*
|
1659
1775
|
* @version 16.8.0
|
1660
|
-
* @see https://react.dev/reference/react/useEffect
|
1776
|
+
* @see {@link https://react.dev/reference/react/useEffect}
|
1661
1777
|
*/
|
1662
1778
|
function useEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1663
1779
|
// NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T>
|
@@ -1668,7 +1784,7 @@ declare namespace React {
|
|
1668
1784
|
* `useImperativeHandle` should be used with `React.forwardRef`.
|
1669
1785
|
*
|
1670
1786
|
* @version 16.8.0
|
1671
|
-
* @see https://react.dev/reference/react/useImperativeHandle
|
1787
|
+
* @see {@link https://react.dev/reference/react/useImperativeHandle}
|
1672
1788
|
*/
|
1673
1789
|
function useImperativeHandle<T, R extends T>(ref: Ref<T> | undefined, init: () => R, deps?: DependencyList): void;
|
1674
1790
|
// I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key
|
@@ -1678,7 +1794,7 @@ declare namespace React {
|
|
1678
1794
|
* has changed.
|
1679
1795
|
*
|
1680
1796
|
* @version 16.8.0
|
1681
|
-
* @see https://react.dev/reference/react/useCallback
|
1797
|
+
* @see {@link https://react.dev/reference/react/useCallback}
|
1682
1798
|
*/
|
1683
1799
|
// A specific function type would not trigger implicit any.
|
1684
1800
|
// See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types.
|
@@ -1688,7 +1804,7 @@ declare namespace React {
|
|
1688
1804
|
* `useMemo` will only recompute the memoized value when one of the `deps` has changed.
|
1689
1805
|
*
|
1690
1806
|
* @version 16.8.0
|
1691
|
-
* @see https://react.dev/reference/react/useMemo
|
1807
|
+
* @see {@link https://react.dev/reference/react/useMemo}
|
1692
1808
|
*/
|
1693
1809
|
// allow undefined, but don't make it optional as that is very likely a mistake
|
1694
1810
|
function useMemo<T>(factory: () => T, deps: DependencyList): T;
|
@@ -1699,7 +1815,7 @@ declare namespace React {
|
|
1699
1815
|
* It’s most valuable for custom hooks that are part of shared libraries.
|
1700
1816
|
*
|
1701
1817
|
* @version 16.8.0
|
1702
|
-
* @see https://react.dev/reference/react/useDebugValue
|
1818
|
+
* @see {@link https://react.dev/reference/react/useDebugValue}
|
1703
1819
|
*/
|
1704
1820
|
// the name of the custom hook is itself derived from the function name at runtime:
|
1705
1821
|
// it's just the function name without the "use" prefix.
|
@@ -1729,7 +1845,7 @@ declare namespace React {
|
|
1729
1845
|
*
|
1730
1846
|
* @param value The value that is going to be deferred
|
1731
1847
|
*
|
1732
|
-
* @see https://react.dev/reference/react/useDeferredValue
|
1848
|
+
* @see {@link https://react.dev/reference/react/useDeferredValue}
|
1733
1849
|
*/
|
1734
1850
|
export function useDeferredValue<T>(value: T): T;
|
1735
1851
|
|
@@ -1746,7 +1862,7 @@ declare namespace React {
|
|
1746
1862
|
*
|
1747
1863
|
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
1748
1864
|
*
|
1749
|
-
* @see https://react.dev/reference/react/useTransition
|
1865
|
+
* @see {@link https://react.dev/reference/react/useTransition}
|
1750
1866
|
*/
|
1751
1867
|
export function useTransition(): [boolean, TransitionStartFunction];
|
1752
1868
|
|
@@ -1763,7 +1879,7 @@ declare namespace React {
|
|
1763
1879
|
* @param effect Imperative function that can return a cleanup function
|
1764
1880
|
* @param deps If present, effect will only activate if the values in the list change.
|
1765
1881
|
*
|
1766
|
-
* @see https://github.com/facebook/react/pull/21913
|
1882
|
+
* @see {@link https://github.com/facebook/react/pull/21913}
|
1767
1883
|
*/
|
1768
1884
|
export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1769
1885
|
|
@@ -1771,7 +1887,7 @@ declare namespace React {
|
|
1771
1887
|
* @param subscribe
|
1772
1888
|
* @param getSnapshot
|
1773
1889
|
*
|
1774
|
-
* @see https://github.com/reactwg/react-18/discussions/86
|
1890
|
+
* @see {@link https://github.com/reactwg/react-18/discussions/86}
|
1775
1891
|
*/
|
1776
1892
|
// keep in sync with `useSyncExternalStore` from `use-sync-external-store`
|
1777
1893
|
export function useSyncExternalStore<Snapshot>(
|
@@ -2564,12 +2680,12 @@ declare namespace React {
|
|
2564
2680
|
// Living Standard
|
2565
2681
|
/**
|
2566
2682
|
* Hints at the type of data that might be entered by the user while editing the element or its contents
|
2567
|
-
* @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute
|
2683
|
+
* @see {@link https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute}
|
2568
2684
|
*/
|
2569
2685
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
2570
2686
|
/**
|
2571
2687
|
* Specify that a standard HTML element should behave like a defined custom built-in element
|
2572
|
-
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is
|
2688
|
+
* @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is}
|
2573
2689
|
*/
|
2574
2690
|
is?: string | undefined;
|
2575
2691
|
}
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "18.2.
|
3
|
+
"version": "18.2.52",
|
4
4
|
"description": "TypeScript definitions for react",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
|
6
6
|
"license": "MIT",
|
@@ -201,6 +201,6 @@
|
|
201
201
|
"@types/scheduler": "*",
|
202
202
|
"csstype": "^3.0.2"
|
203
203
|
},
|
204
|
-
"typesPublisherContentHash": "
|
204
|
+
"typesPublisherContentHash": "93fc940a3cfa823f1e10e0c4058e113f5fcc839de2adf5b2c9b6046991b0a4e0",
|
205
205
|
"typeScriptVersion": "4.6"
|
206
206
|
}
|