@types/react 18.2.79 → 18.3.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/index.d.ts +59 -6
- react/package.json +2 -2
- react/ts5.0/index.d.ts +59 -6
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: Fri, 26 Apr 2024 21:06:49 GMT
|
12
12
|
* Dependencies: [@types/prop-types](https://npmjs.com/package/@types/prop-types), [csstype](https://npmjs.com/package/csstype)
|
13
13
|
|
14
14
|
# Credits
|
react/index.d.ts
CHANGED
@@ -222,7 +222,7 @@ declare namespace React {
|
|
222
222
|
C extends
|
223
223
|
| ForwardRefExoticComponent<any>
|
224
224
|
| { new(props: any): Component<any> }
|
225
|
-
| ((props: any,
|
225
|
+
| ((props: any, deprecatedLegacyContext?: any) => ReactNode)
|
226
226
|
| keyof JSX.IntrinsicElements,
|
227
227
|
> =
|
228
228
|
// need to check first if `ref` is a valid prop for ts@3.0
|
@@ -493,21 +493,27 @@ declare namespace React {
|
|
493
493
|
// ----------------------------------------------------------------------
|
494
494
|
|
495
495
|
// DOM Elements
|
496
|
+
/** @deprecated */
|
496
497
|
function createFactory<T extends HTMLElement>(
|
497
498
|
type: keyof ReactHTML,
|
498
499
|
): HTMLFactory<T>;
|
500
|
+
/** @deprecated */
|
499
501
|
function createFactory(
|
500
502
|
type: keyof ReactSVG,
|
501
503
|
): SVGFactory;
|
504
|
+
/** @deprecated */
|
502
505
|
function createFactory<P extends DOMAttributes<T>, T extends Element>(
|
503
506
|
type: string,
|
504
507
|
): DOMFactory<P, T>;
|
505
508
|
|
506
509
|
// Custom components
|
510
|
+
/** @deprecated */
|
507
511
|
function createFactory<P>(type: FunctionComponent<P>): FunctionComponentFactory<P>;
|
512
|
+
/** @deprecated */
|
508
513
|
function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
|
509
514
|
type: ClassType<P, T, C>,
|
510
515
|
): CFactory<P, T>;
|
516
|
+
/** @deprecated */
|
511
517
|
function createFactory<P>(type: ComponentClass<P>): Factory<P>;
|
512
518
|
|
513
519
|
// DOM Elements
|
@@ -1105,7 +1111,15 @@ declare namespace React {
|
|
1105
1111
|
* ```
|
1106
1112
|
*/
|
1107
1113
|
interface FunctionComponent<P = {}> {
|
1108
|
-
(
|
1114
|
+
(
|
1115
|
+
props: P,
|
1116
|
+
/**
|
1117
|
+
* @deprecated
|
1118
|
+
*
|
1119
|
+
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs}
|
1120
|
+
*/
|
1121
|
+
deprecatedLegacyContext?: any,
|
1122
|
+
): ReactNode;
|
1109
1123
|
/**
|
1110
1124
|
* Used to declare the types of the props accepted by the
|
1111
1125
|
* component. These types will be checked during rendering
|
@@ -1145,6 +1159,8 @@ declare namespace React {
|
|
1145
1159
|
* name: 'John Doe'
|
1146
1160
|
* }
|
1147
1161
|
* ```
|
1162
|
+
*
|
1163
|
+
* @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}.
|
1148
1164
|
*/
|
1149
1165
|
defaultProps?: Partial<P> | undefined;
|
1150
1166
|
/**
|
@@ -1182,9 +1198,20 @@ declare namespace React {
|
|
1182
1198
|
* @see {@link React.FunctionComponent}
|
1183
1199
|
*/
|
1184
1200
|
interface VoidFunctionComponent<P = {}> {
|
1185
|
-
(
|
1201
|
+
(
|
1202
|
+
props: P,
|
1203
|
+
/**
|
1204
|
+
* @deprecated
|
1205
|
+
*
|
1206
|
+
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs}
|
1207
|
+
*/
|
1208
|
+
deprecatedLegacyContext?: any,
|
1209
|
+
): ReactNode;
|
1186
1210
|
propTypes?: WeakValidationMap<P> | undefined;
|
1187
1211
|
contextTypes?: ValidationMap<any> | undefined;
|
1212
|
+
/**
|
1213
|
+
* @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}.
|
1214
|
+
*/
|
1188
1215
|
defaultProps?: Partial<P> | undefined;
|
1189
1216
|
displayName?: string | undefined;
|
1190
1217
|
}
|
@@ -1245,7 +1272,15 @@ declare namespace React {
|
|
1245
1272
|
* @template S The internal state of the component.
|
1246
1273
|
*/
|
1247
1274
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
1248
|
-
new(
|
1275
|
+
new(
|
1276
|
+
props: P,
|
1277
|
+
/**
|
1278
|
+
* @deprecated
|
1279
|
+
*
|
1280
|
+
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs}
|
1281
|
+
*/
|
1282
|
+
deprecatedLegacyContext?: any,
|
1283
|
+
): Component<P, S>;
|
1249
1284
|
/**
|
1250
1285
|
* Used to declare the types of the props accepted by the
|
1251
1286
|
* component. These types will be checked during rendering
|
@@ -1297,7 +1332,7 @@ declare namespace React {
|
|
1297
1332
|
* @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm}
|
1298
1333
|
*/
|
1299
1334
|
interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
|
1300
|
-
new(props: P,
|
1335
|
+
new(props: P, deprecatedLegacyContext?: any): ClassicComponent<P, ComponentState>;
|
1301
1336
|
getDefaultProps?(): P;
|
1302
1337
|
}
|
1303
1338
|
|
@@ -1312,7 +1347,7 @@ declare namespace React {
|
|
1312
1347
|
*/
|
1313
1348
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
1314
1349
|
& C
|
1315
|
-
& (new(props: P,
|
1350
|
+
& (new(props: P, deprecatedLegacyContext?: any) => T);
|
1316
1351
|
|
1317
1352
|
//
|
1318
1353
|
// Component Specs and Lifecycle
|
@@ -1527,6 +1562,9 @@ declare namespace React {
|
|
1527
1562
|
* @see {@link ExoticComponent}
|
1528
1563
|
*/
|
1529
1564
|
interface ForwardRefExoticComponent<P> extends NamedExoticComponent<P> {
|
1565
|
+
/**
|
1566
|
+
* @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}.
|
1567
|
+
*/
|
1530
1568
|
defaultProps?: Partial<P> | undefined;
|
1531
1569
|
propTypes?: WeakValidationMap<P> | undefined;
|
1532
1570
|
}
|
@@ -2088,6 +2126,21 @@ declare namespace React {
|
|
2088
2126
|
*/
|
2089
2127
|
export function startTransition(scope: TransitionFunction): void;
|
2090
2128
|
|
2129
|
+
/**
|
2130
|
+
* Wrap any code rendering and triggering updates to your components into `act()` calls.
|
2131
|
+
*
|
2132
|
+
* Ensures that the behavior in your tests matches what happens in the browser
|
2133
|
+
* more closely by executing pending `useEffect`s before returning. This also
|
2134
|
+
* reduces the amount of re-renders done.
|
2135
|
+
*
|
2136
|
+
* @param callback A synchronous, void callback that will execute as a single, complete React commit.
|
2137
|
+
*
|
2138
|
+
* @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
|
2139
|
+
*/
|
2140
|
+
// While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules.
|
2141
|
+
export function act(callback: () => VoidOrUndefinedOnly): void;
|
2142
|
+
export function act<T>(callback: () => T | Promise<T>): Promise<T>;
|
2143
|
+
|
2091
2144
|
export function useId(): string;
|
2092
2145
|
|
2093
2146
|
/**
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "18.
|
3
|
+
"version": "18.3.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
|
"@types/prop-types": "*",
|
206
206
|
"csstype": "^3.0.2"
|
207
207
|
},
|
208
|
-
"typesPublisherContentHash": "
|
208
|
+
"typesPublisherContentHash": "0a7e72b3c121016aa40006c290d4d367a7a99b6bf63c3884af050937991f6ddd",
|
209
209
|
"typeScriptVersion": "4.7"
|
210
210
|
}
|
react/ts5.0/index.d.ts
CHANGED
@@ -222,7 +222,7 @@ declare namespace React {
|
|
222
222
|
C extends
|
223
223
|
| ForwardRefExoticComponent<any>
|
224
224
|
| { new(props: any): Component<any> }
|
225
|
-
| ((props: any,
|
225
|
+
| ((props: any, deprecatedLegacyContext?: any) => ReactElement | null)
|
226
226
|
| keyof JSX.IntrinsicElements,
|
227
227
|
> =
|
228
228
|
// need to check first if `ref` is a valid prop for ts@3.0
|
@@ -494,21 +494,27 @@ declare namespace React {
|
|
494
494
|
// ----------------------------------------------------------------------
|
495
495
|
|
496
496
|
// DOM Elements
|
497
|
+
/** @deprecated */
|
497
498
|
function createFactory<T extends HTMLElement>(
|
498
499
|
type: keyof ReactHTML,
|
499
500
|
): HTMLFactory<T>;
|
501
|
+
/** @deprecated */
|
500
502
|
function createFactory(
|
501
503
|
type: keyof ReactSVG,
|
502
504
|
): SVGFactory;
|
505
|
+
/** @deprecated */
|
503
506
|
function createFactory<P extends DOMAttributes<T>, T extends Element>(
|
504
507
|
type: string,
|
505
508
|
): DOMFactory<P, T>;
|
506
509
|
|
507
510
|
// Custom components
|
511
|
+
/** @deprecated */
|
508
512
|
function createFactory<P>(type: FunctionComponent<P>): FunctionComponentFactory<P>;
|
513
|
+
/** @deprecated */
|
509
514
|
function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
|
510
515
|
type: ClassType<P, T, C>,
|
511
516
|
): CFactory<P, T>;
|
517
|
+
/** @deprecated */
|
512
518
|
function createFactory<P>(type: ComponentClass<P>): Factory<P>;
|
513
519
|
|
514
520
|
// DOM Elements
|
@@ -1106,7 +1112,15 @@ declare namespace React {
|
|
1106
1112
|
* ```
|
1107
1113
|
*/
|
1108
1114
|
interface FunctionComponent<P = {}> {
|
1109
|
-
(
|
1115
|
+
(
|
1116
|
+
props: P,
|
1117
|
+
/**
|
1118
|
+
* @deprecated
|
1119
|
+
*
|
1120
|
+
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs}
|
1121
|
+
*/
|
1122
|
+
deprecatedLegacyContext?: any,
|
1123
|
+
): ReactElement<any, any> | null;
|
1110
1124
|
/**
|
1111
1125
|
* Used to declare the types of the props accepted by the
|
1112
1126
|
* component. These types will be checked during rendering
|
@@ -1146,6 +1160,8 @@ declare namespace React {
|
|
1146
1160
|
* name: 'John Doe'
|
1147
1161
|
* }
|
1148
1162
|
* ```
|
1163
|
+
*
|
1164
|
+
* @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}.
|
1149
1165
|
*/
|
1150
1166
|
defaultProps?: Partial<P> | undefined;
|
1151
1167
|
/**
|
@@ -1183,9 +1199,20 @@ declare namespace React {
|
|
1183
1199
|
* @see {@link React.FunctionComponent}
|
1184
1200
|
*/
|
1185
1201
|
interface VoidFunctionComponent<P = {}> {
|
1186
|
-
(
|
1202
|
+
(
|
1203
|
+
props: P,
|
1204
|
+
/**
|
1205
|
+
* @deprecated
|
1206
|
+
*
|
1207
|
+
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs}
|
1208
|
+
*/
|
1209
|
+
deprecatedLegacyContext?: any,
|
1210
|
+
): ReactElement<any, any> | null;
|
1187
1211
|
propTypes?: WeakValidationMap<P> | undefined;
|
1188
1212
|
contextTypes?: ValidationMap<any> | undefined;
|
1213
|
+
/**
|
1214
|
+
* @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}.
|
1215
|
+
*/
|
1189
1216
|
defaultProps?: Partial<P> | undefined;
|
1190
1217
|
displayName?: string | undefined;
|
1191
1218
|
}
|
@@ -1246,7 +1273,15 @@ declare namespace React {
|
|
1246
1273
|
* @template S The internal state of the component.
|
1247
1274
|
*/
|
1248
1275
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
1249
|
-
new(
|
1276
|
+
new(
|
1277
|
+
props: P,
|
1278
|
+
/**
|
1279
|
+
* @deprecated
|
1280
|
+
*
|
1281
|
+
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs}
|
1282
|
+
*/
|
1283
|
+
deprecatedLegacyContext?: any,
|
1284
|
+
): Component<P, S>;
|
1250
1285
|
/**
|
1251
1286
|
* Used to declare the types of the props accepted by the
|
1252
1287
|
* component. These types will be checked during rendering
|
@@ -1298,7 +1333,7 @@ declare namespace React {
|
|
1298
1333
|
* @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm}
|
1299
1334
|
*/
|
1300
1335
|
interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
|
1301
|
-
new(props: P,
|
1336
|
+
new(props: P, deprecatedLegacyContext?: any): ClassicComponent<P, ComponentState>;
|
1302
1337
|
getDefaultProps?(): P;
|
1303
1338
|
}
|
1304
1339
|
|
@@ -1313,7 +1348,7 @@ declare namespace React {
|
|
1313
1348
|
*/
|
1314
1349
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
1315
1350
|
& C
|
1316
|
-
& (new(props: P,
|
1351
|
+
& (new(props: P, deprecatedLegacyContext?: any) => T);
|
1317
1352
|
|
1318
1353
|
//
|
1319
1354
|
// Component Specs and Lifecycle
|
@@ -1528,6 +1563,9 @@ declare namespace React {
|
|
1528
1563
|
* @see {@link ExoticComponent}
|
1529
1564
|
*/
|
1530
1565
|
interface ForwardRefExoticComponent<P> extends NamedExoticComponent<P> {
|
1566
|
+
/**
|
1567
|
+
* @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}.
|
1568
|
+
*/
|
1531
1569
|
defaultProps?: Partial<P> | undefined;
|
1532
1570
|
propTypes?: WeakValidationMap<P> | undefined;
|
1533
1571
|
}
|
@@ -2089,6 +2127,21 @@ declare namespace React {
|
|
2089
2127
|
*/
|
2090
2128
|
export function startTransition(scope: TransitionFunction): void;
|
2091
2129
|
|
2130
|
+
/**
|
2131
|
+
* Wrap any code rendering and triggering updates to your components into `act()` calls.
|
2132
|
+
*
|
2133
|
+
* Ensures that the behavior in your tests matches what happens in the browser
|
2134
|
+
* more closely by executing pending `useEffect`s before returning. This also
|
2135
|
+
* reduces the amount of re-renders done.
|
2136
|
+
*
|
2137
|
+
* @param callback A synchronous, void callback that will execute as a single, complete React commit.
|
2138
|
+
*
|
2139
|
+
* @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
|
2140
|
+
*/
|
2141
|
+
// While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules.
|
2142
|
+
export function act(callback: () => VoidOrUndefinedOnly): void;
|
2143
|
+
export function act<T>(callback: () => T | Promise<T>): Promise<T>;
|
2144
|
+
|
2092
2145
|
export function useId(): string;
|
2093
2146
|
|
2094
2147
|
/**
|