@types/react 19.1.5 → 19.1.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/index.d.ts +23 -5
- react/package.json +2 -2
- react/ts5.0/index.d.ts +22 -5
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: Mon, 09 Jun 2025 20:02:33 GMT
|
12
12
|
* Dependencies: [csstype](https://npmjs.com/package/csstype)
|
13
13
|
|
14
14
|
# Credits
|
react/index.d.ts
CHANGED
@@ -135,7 +135,7 @@ declare namespace React {
|
|
135
135
|
props: P,
|
136
136
|
) => ReactNode | Promise<ReactNode>)
|
137
137
|
// constructor signature must match React.Component
|
138
|
-
| (new(props: P) => Component<any, any>);
|
138
|
+
| (new(props: P, context: any) => Component<any, any>);
|
139
139
|
|
140
140
|
/**
|
141
141
|
* Created by {@link createRef}, or {@link useRef} when passed `null`.
|
@@ -218,7 +218,7 @@ declare namespace React {
|
|
218
218
|
type ElementRef<
|
219
219
|
C extends
|
220
220
|
| ForwardRefExoticComponent<any>
|
221
|
-
| { new(props: any): Component<any> }
|
221
|
+
| { new(props: any, context: any): Component<any> }
|
222
222
|
| ((props: any) => ReactNode)
|
223
223
|
| keyof JSX.IntrinsicElements,
|
224
224
|
> = ComponentRef<C>;
|
@@ -928,7 +928,7 @@ declare namespace React {
|
|
928
928
|
static propTypes?: any;
|
929
929
|
|
930
930
|
/**
|
931
|
-
* If using
|
931
|
+
* If using React Context, re-declare this in your class to be the
|
932
932
|
* `React.ContextType` of your `static contextType`.
|
933
933
|
* Should be used with type annotation or static contextType.
|
934
934
|
*
|
@@ -947,6 +947,14 @@ declare namespace React {
|
|
947
947
|
|
948
948
|
// Keep in sync with constructor signature of JSXElementConstructor and ComponentClass.
|
949
949
|
constructor(props: P);
|
950
|
+
/**
|
951
|
+
* @param props
|
952
|
+
* @param context value of the parent {@link https://react.dev/reference/react/Component#context Context} specified
|
953
|
+
* in `contextType`.
|
954
|
+
*/
|
955
|
+
// TODO: Ideally we'd infer the constructor signatur from `contextType`.
|
956
|
+
// Might be hard to ship without breaking existing code.
|
957
|
+
constructor(props: P, context: any);
|
950
958
|
|
951
959
|
// We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
|
952
960
|
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
|
@@ -1118,7 +1126,14 @@ declare namespace React {
|
|
1118
1126
|
*/
|
1119
1127
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
1120
1128
|
// constructor signature must match React.Component
|
1121
|
-
new(
|
1129
|
+
new(
|
1130
|
+
props: P,
|
1131
|
+
/**
|
1132
|
+
* Value of the parent {@link https://react.dev/reference/react/Component#context Context} specified
|
1133
|
+
* in `contextType`.
|
1134
|
+
*/
|
1135
|
+
context?: any,
|
1136
|
+
): Component<P, S>;
|
1122
1137
|
/**
|
1123
1138
|
* Ignored by React.
|
1124
1139
|
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
@@ -1158,7 +1173,7 @@ declare namespace React {
|
|
1158
1173
|
*/
|
1159
1174
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
1160
1175
|
& C
|
1161
|
-
& (new(props: P) => T);
|
1176
|
+
& (new(props: P, context: any) => T);
|
1162
1177
|
|
1163
1178
|
//
|
1164
1179
|
// Component Specs and Lifecycle
|
@@ -3225,6 +3240,7 @@ declare namespace React {
|
|
3225
3240
|
|
3226
3241
|
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
3227
3242
|
as?: string | undefined;
|
3243
|
+
blocking?: "render" | (string & {}) | undefined;
|
3228
3244
|
crossOrigin?: CrossOrigin;
|
3229
3245
|
fetchPriority?: "high" | "low" | "auto";
|
3230
3246
|
href?: string | undefined;
|
@@ -3344,6 +3360,7 @@ declare namespace React {
|
|
3344
3360
|
|
3345
3361
|
interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
|
3346
3362
|
async?: boolean | undefined;
|
3363
|
+
blocking?: "render" | (string & {}) | undefined;
|
3347
3364
|
/** @deprecated */
|
3348
3365
|
charSet?: string | undefined;
|
3349
3366
|
crossOrigin?: CrossOrigin;
|
@@ -3378,6 +3395,7 @@ declare namespace React {
|
|
3378
3395
|
}
|
3379
3396
|
|
3380
3397
|
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
|
3398
|
+
blocking?: "render" | (string & {}) | undefined;
|
3381
3399
|
media?: string | undefined;
|
3382
3400
|
scoped?: boolean | undefined;
|
3383
3401
|
type?: string | undefined;
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "19.1.
|
3
|
+
"version": "19.1.7",
|
4
4
|
"description": "TypeScript definitions for react",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
|
6
6
|
"license": "MIT",
|
@@ -205,6 +205,6 @@
|
|
205
205
|
"csstype": "^3.0.2"
|
206
206
|
},
|
207
207
|
"peerDependencies": {},
|
208
|
-
"typesPublisherContentHash": "
|
208
|
+
"typesPublisherContentHash": "5ea13c31e4a3bf8c9037908593dd7369d3c55bc17a3fa4cea0005bf0fb8e5790",
|
209
209
|
"typeScriptVersion": "5.1"
|
210
210
|
}
|
react/ts5.0/index.d.ts
CHANGED
@@ -135,7 +135,7 @@ declare namespace React {
|
|
135
135
|
props: P,
|
136
136
|
) => ReactElement<any, any> | null)
|
137
137
|
// constructor signature must match React.Component
|
138
|
-
| (new(props: P) => Component<any, any>);
|
138
|
+
| (new(props: P, context: any) => Component<any, any>);
|
139
139
|
|
140
140
|
/**
|
141
141
|
* Created by {@link createRef}, or {@link useRef} when passed `null`.
|
@@ -218,7 +218,7 @@ declare namespace React {
|
|
218
218
|
type ElementRef<
|
219
219
|
C extends
|
220
220
|
| ForwardRefExoticComponent<any>
|
221
|
-
| { new(props: any): Component<any> }
|
221
|
+
| { new(props: any, context: any): Component<any> }
|
222
222
|
| ((props: any) => ReactElement | null)
|
223
223
|
| keyof JSX.IntrinsicElements,
|
224
224
|
> = ComponentRef<C>;
|
@@ -929,7 +929,7 @@ declare namespace React {
|
|
929
929
|
static propTypes?: any;
|
930
930
|
|
931
931
|
/**
|
932
|
-
* If using
|
932
|
+
* If using React Context, re-declare this in your class to be the
|
933
933
|
* `React.ContextType` of your `static contextType`.
|
934
934
|
* Should be used with type annotation or static contextType.
|
935
935
|
*
|
@@ -948,6 +948,14 @@ declare namespace React {
|
|
948
948
|
|
949
949
|
// Keep in sync with constructor signature of JSXElementConstructor and ComponentClass.
|
950
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);
|
951
959
|
|
952
960
|
// We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
|
953
961
|
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
|
@@ -1117,7 +1125,13 @@ declare namespace React {
|
|
1117
1125
|
*/
|
1118
1126
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
1119
1127
|
// constructor signature must match React.Component
|
1120
|
-
new(
|
1128
|
+
new(
|
1129
|
+
props: P, /**
|
1130
|
+
* Value of the parent {@link https://react.dev/reference/react/Component#context Context} specified
|
1131
|
+
* in `contextType`.
|
1132
|
+
*/
|
1133
|
+
context?: any,
|
1134
|
+
): Component<P, S>;
|
1121
1135
|
/**
|
1122
1136
|
* Ignored by React.
|
1123
1137
|
* @deprecated Only kept in types for backwards compatibility. Will be removed in a future major release.
|
@@ -1157,7 +1171,7 @@ declare namespace React {
|
|
1157
1171
|
*/
|
1158
1172
|
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
|
1159
1173
|
& C
|
1160
|
-
& (new(props: P) => T);
|
1174
|
+
& (new(props: P, context: any) => T);
|
1161
1175
|
|
1162
1176
|
//
|
1163
1177
|
// Component Specs and Lifecycle
|
@@ -3224,6 +3238,7 @@ declare namespace React {
|
|
3224
3238
|
|
3225
3239
|
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
3226
3240
|
as?: string | undefined;
|
3241
|
+
blocking?: "render" | (string & {}) | undefined;
|
3227
3242
|
crossOrigin?: CrossOrigin;
|
3228
3243
|
fetchPriority?: "high" | "low" | "auto";
|
3229
3244
|
href?: string | undefined;
|
@@ -3343,6 +3358,7 @@ declare namespace React {
|
|
3343
3358
|
|
3344
3359
|
interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
|
3345
3360
|
async?: boolean | undefined;
|
3361
|
+
blocking?: "render" | (string & {}) | undefined;
|
3346
3362
|
/** @deprecated */
|
3347
3363
|
charSet?: string | undefined;
|
3348
3364
|
crossOrigin?: CrossOrigin;
|
@@ -3377,6 +3393,7 @@ declare namespace React {
|
|
3377
3393
|
}
|
3378
3394
|
|
3379
3395
|
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
|
3396
|
+
blocking?: "render" | (string & {}) | undefined;
|
3380
3397
|
media?: string | undefined;
|
3381
3398
|
scoped?: boolean | undefined;
|
3382
3399
|
type?: string | undefined;
|