@types/react 18.2.67 → 18.2.75
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 +2 -2
- react/canary.d.ts +24 -2
- react/index.d.ts +27 -4
- react/package.json +2 -3
- react/ts5.0/canary.d.ts +24 -2
- react/ts5.0/index.d.ts +27 -4
react/README.md
CHANGED
@@ -8,8 +8,8 @@ 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: Mon,
|
12
|
-
* Dependencies: [@types/prop-types](https://npmjs.com/package/@types/prop-types), [
|
11
|
+
* Last updated: Mon, 08 Apr 2024 22:35:33 GMT
|
12
|
+
* Dependencies: [@types/prop-types](https://npmjs.com/package/@types/prop-types), [csstype](https://npmjs.com/package/csstype)
|
13
13
|
|
14
14
|
# Credits
|
15
15
|
These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), [Dale Tan](https://github.com/hellatan), [Priyanshu Rav](https://github.com/priyanshurav), [Dmitry Semigradsky](https://github.com/Semigradsky), and [Matt Pocock](https://github.com/mattpocock).
|
react/canary.d.ts
CHANGED
@@ -102,11 +102,33 @@ declare module "." {
|
|
102
102
|
(callback: () => Promise<VoidOrUndefinedOnly>): void;
|
103
103
|
}
|
104
104
|
|
105
|
-
|
105
|
+
/**
|
106
|
+
* Similar to `useTransition` but allows uses where hooks are not available.
|
107
|
+
*
|
108
|
+
* @param callback An _asynchronous_ function which causes state updates that can be deferred.
|
109
|
+
*/
|
110
|
+
export function startTransition(scope: () => Promise<VoidOrUndefinedOnly>): void;
|
111
|
+
|
112
|
+
export function useOptimistic<State>(
|
106
113
|
passthrough: State,
|
107
114
|
): [State, (action: State | ((pendingState: State) => State)) => void];
|
108
|
-
function useOptimistic<State, Action>(
|
115
|
+
export function useOptimistic<State, Action>(
|
109
116
|
passthrough: State,
|
110
117
|
reducer: (state: State, action: Action) => State,
|
111
118
|
): [State, (action: Action) => void];
|
119
|
+
|
120
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
|
121
|
+
cleanup: () => VoidOrUndefinedOnly;
|
122
|
+
}
|
123
|
+
|
124
|
+
export function useActionState<State>(
|
125
|
+
action: (state: Awaited<State>) => State | Promise<State>,
|
126
|
+
initialState: Awaited<State>,
|
127
|
+
permalink?: string,
|
128
|
+
): [state: Awaited<State>, dispatch: () => void, isPending: boolean];
|
129
|
+
export function useActionState<State, Payload>(
|
130
|
+
action: (state: Awaited<State>, payload: Payload) => State | Promise<State>,
|
131
|
+
initialState: Awaited<State>,
|
132
|
+
permalink?: string,
|
133
|
+
): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean];
|
112
134
|
}
|
react/index.d.ts
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
|
7
7
|
import * as CSS from "csstype";
|
8
8
|
import * as PropTypes from "prop-types";
|
9
|
-
import { Interaction as SchedulerInteraction } from "scheduler/tracing";
|
10
9
|
|
11
10
|
type NativeAnimationEvent = AnimationEvent;
|
12
11
|
type NativeClipboardEvent = ClipboardEvent;
|
@@ -155,6 +154,8 @@ declare namespace React {
|
|
155
154
|
readonly current: T | null;
|
156
155
|
}
|
157
156
|
|
157
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
|
158
|
+
}
|
158
159
|
/**
|
159
160
|
* A callback fired whenever the ref's value changes.
|
160
161
|
*
|
@@ -168,7 +169,15 @@ declare namespace React {
|
|
168
169
|
* <div ref={(node) => console.log(node)} />
|
169
170
|
* ```
|
170
171
|
*/
|
171
|
-
type RefCallback<T> = {
|
172
|
+
type RefCallback<T> = {
|
173
|
+
bivarianceHack(
|
174
|
+
instance: T | null,
|
175
|
+
):
|
176
|
+
| void
|
177
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[
|
178
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES
|
179
|
+
];
|
180
|
+
}["bivarianceHack"];
|
172
181
|
|
173
182
|
/**
|
174
183
|
* A union type of all possible shapes for React refs.
|
@@ -907,7 +916,6 @@ declare namespace React {
|
|
907
916
|
* @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
|
908
917
|
*/
|
909
918
|
commitTime: number,
|
910
|
-
interactions: Set<SchedulerInteraction>,
|
911
919
|
) => void;
|
912
920
|
|
913
921
|
/**
|
@@ -985,7 +993,7 @@ declare namespace React {
|
|
985
993
|
*/
|
986
994
|
context: unknown;
|
987
995
|
|
988
|
-
constructor(props:
|
996
|
+
constructor(props: P);
|
989
997
|
/**
|
990
998
|
* @deprecated
|
991
999
|
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html React Docs}
|
@@ -4069,18 +4077,33 @@ declare namespace React {
|
|
4069
4077
|
// React.PropTypes
|
4070
4078
|
// ----------------------------------------------------------------------
|
4071
4079
|
|
4080
|
+
/**
|
4081
|
+
* @deprecated Use `Validator` from the ´prop-types` instead.
|
4082
|
+
*/
|
4072
4083
|
type Validator<T> = PropTypes.Validator<T>;
|
4073
4084
|
|
4085
|
+
/**
|
4086
|
+
* @deprecated Use `Requireable` from the ´prop-types` instead.
|
4087
|
+
*/
|
4074
4088
|
type Requireable<T> = PropTypes.Requireable<T>;
|
4075
4089
|
|
4090
|
+
/**
|
4091
|
+
* @deprecated Use `ValidationMap` from the ´prop-types` instead.
|
4092
|
+
*/
|
4076
4093
|
type ValidationMap<T> = PropTypes.ValidationMap<T>;
|
4077
4094
|
|
4095
|
+
/**
|
4096
|
+
* @deprecated Use `WeakValidationMap` from the ´prop-types` instead.
|
4097
|
+
*/
|
4078
4098
|
type WeakValidationMap<T> = {
|
4079
4099
|
[K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined>
|
4080
4100
|
: undefined extends T[K] ? Validator<T[K] | null | undefined>
|
4081
4101
|
: Validator<T[K]>;
|
4082
4102
|
};
|
4083
4103
|
|
4104
|
+
/**
|
4105
|
+
* @deprecated Use `PropTypes.*` where `PropTypes` comes from `import * as PropTypes from 'prop-types'` instead.
|
4106
|
+
*/
|
4084
4107
|
interface ReactPropTypes {
|
4085
4108
|
any: typeof PropTypes.any;
|
4086
4109
|
array: typeof PropTypes.array;
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "18.2.
|
3
|
+
"version": "18.2.75",
|
4
4
|
"description": "TypeScript definitions for react",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
|
6
6
|
"license": "MIT",
|
@@ -203,9 +203,8 @@
|
|
203
203
|
"scripts": {},
|
204
204
|
"dependencies": {
|
205
205
|
"@types/prop-types": "*",
|
206
|
-
"@types/scheduler": "*",
|
207
206
|
"csstype": "^3.0.2"
|
208
207
|
},
|
209
|
-
"typesPublisherContentHash": "
|
208
|
+
"typesPublisherContentHash": "d89da57e1e91057f788667d390c9e24d8a9beb0c6945409d681e9dd33facb8a0",
|
210
209
|
"typeScriptVersion": "4.7"
|
211
210
|
}
|
react/ts5.0/canary.d.ts
CHANGED
@@ -102,11 +102,33 @@ declare module "." {
|
|
102
102
|
(callback: () => Promise<VoidOrUndefinedOnly>): void;
|
103
103
|
}
|
104
104
|
|
105
|
-
|
105
|
+
/**
|
106
|
+
* Similar to `useTransition` but allows uses where hooks are not available.
|
107
|
+
*
|
108
|
+
* @param callback An _asynchronous_ function which causes state updates that can be deferred.
|
109
|
+
*/
|
110
|
+
export function startTransition(scope: () => Promise<VoidOrUndefinedOnly>): void;
|
111
|
+
|
112
|
+
export function useOptimistic<State>(
|
106
113
|
passthrough: State,
|
107
114
|
): [State, (action: State | ((pendingState: State) => State)) => void];
|
108
|
-
function useOptimistic<State, Action>(
|
115
|
+
export function useOptimistic<State, Action>(
|
109
116
|
passthrough: State,
|
110
117
|
reducer: (state: State, action: Action) => State,
|
111
118
|
): [State, (action: Action) => void];
|
119
|
+
|
120
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
|
121
|
+
cleanup: () => VoidOrUndefinedOnly;
|
122
|
+
}
|
123
|
+
|
124
|
+
export function useActionState<State>(
|
125
|
+
action: (state: Awaited<State>) => State | Promise<State>,
|
126
|
+
initialState: Awaited<State>,
|
127
|
+
permalink?: string,
|
128
|
+
): [state: Awaited<State>, dispatch: () => void, isPending: boolean];
|
129
|
+
export function useActionState<State, Payload>(
|
130
|
+
action: (state: Awaited<State>, payload: Payload) => State | Promise<State>,
|
131
|
+
initialState: Awaited<State>,
|
132
|
+
permalink?: string,
|
133
|
+
): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean];
|
112
134
|
}
|
react/ts5.0/index.d.ts
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
|
7
7
|
import * as CSS from "csstype";
|
8
8
|
import * as PropTypes from "prop-types";
|
9
|
-
import { Interaction as SchedulerInteraction } from "scheduler/tracing";
|
10
9
|
|
11
10
|
type NativeAnimationEvent = AnimationEvent;
|
12
11
|
type NativeClipboardEvent = ClipboardEvent;
|
@@ -155,6 +154,8 @@ declare namespace React {
|
|
155
154
|
readonly current: T | null;
|
156
155
|
}
|
157
156
|
|
157
|
+
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
|
158
|
+
}
|
158
159
|
/**
|
159
160
|
* A callback fired whenever the ref's value changes.
|
160
161
|
*
|
@@ -168,7 +169,15 @@ declare namespace React {
|
|
168
169
|
* <div ref={(node) => console.log(node)} />
|
169
170
|
* ```
|
170
171
|
*/
|
171
|
-
type RefCallback<T> = {
|
172
|
+
type RefCallback<T> = {
|
173
|
+
bivarianceHack(
|
174
|
+
instance: T | null,
|
175
|
+
):
|
176
|
+
| void
|
177
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[
|
178
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES
|
179
|
+
];
|
180
|
+
}["bivarianceHack"];
|
172
181
|
|
173
182
|
/**
|
174
183
|
* A union type of all possible shapes for React refs.
|
@@ -908,7 +917,6 @@ declare namespace React {
|
|
908
917
|
* @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs}
|
909
918
|
*/
|
910
919
|
commitTime: number,
|
911
|
-
interactions: Set<SchedulerInteraction>,
|
912
920
|
) => void;
|
913
921
|
|
914
922
|
/**
|
@@ -986,7 +994,7 @@ declare namespace React {
|
|
986
994
|
*/
|
987
995
|
context: unknown;
|
988
996
|
|
989
|
-
constructor(props:
|
997
|
+
constructor(props: P);
|
990
998
|
/**
|
991
999
|
* @deprecated
|
992
1000
|
* @see {@link https://legacy.reactjs.org/docs/legacy-context.html React Docs}
|
@@ -4070,18 +4078,33 @@ declare namespace React {
|
|
4070
4078
|
// React.PropTypes
|
4071
4079
|
// ----------------------------------------------------------------------
|
4072
4080
|
|
4081
|
+
/**
|
4082
|
+
* @deprecated Use `Validator` from the ´prop-types` instead.
|
4083
|
+
*/
|
4073
4084
|
type Validator<T> = PropTypes.Validator<T>;
|
4074
4085
|
|
4086
|
+
/**
|
4087
|
+
* @deprecated Use `Requireable` from the ´prop-types` instead.
|
4088
|
+
*/
|
4075
4089
|
type Requireable<T> = PropTypes.Requireable<T>;
|
4076
4090
|
|
4091
|
+
/**
|
4092
|
+
* @deprecated Use `ValidationMap` from the ´prop-types` instead.
|
4093
|
+
*/
|
4077
4094
|
type ValidationMap<T> = PropTypes.ValidationMap<T>;
|
4078
4095
|
|
4096
|
+
/**
|
4097
|
+
* @deprecated Use `WeakValidationMap` from the ´prop-types` instead.
|
4098
|
+
*/
|
4079
4099
|
type WeakValidationMap<T> = {
|
4080
4100
|
[K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined>
|
4081
4101
|
: undefined extends T[K] ? Validator<T[K] | null | undefined>
|
4082
4102
|
: Validator<T[K]>;
|
4083
4103
|
};
|
4084
4104
|
|
4105
|
+
/**
|
4106
|
+
* @deprecated Use `PropTypes.*` where `PropTypes` comes from `import * as PropTypes from 'prop-types'` instead.
|
4107
|
+
*/
|
4085
4108
|
interface ReactPropTypes {
|
4086
4109
|
any: typeof PropTypes.any;
|
4087
4110
|
array: typeof PropTypes.array;
|