@types/react 18.3.12 → 18.3.14
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 → react v18.3/README.md +2 -2
- react/package.json → react v18.3/package.json +3 -19
- react/canary.d.ts +0 -166
- react/experimental.d.ts +0 -127
- react/ts5.0/canary.d.ts +0 -166
- react/ts5.0/experimental.d.ts +0 -127
- {react → react v18.3}/LICENSE +0 -0
- {react → react v18.3}/global.d.ts +0 -0
- {react → react v18.3}/index.d.ts +0 -0
- {react → react v18.3}/jsx-dev-runtime.d.ts +0 -0
- {react → react v18.3}/jsx-runtime.d.ts +0 -0
- {react → react v18.3}/ts5.0/global.d.ts +0 -0
- {react → react v18.3}/ts5.0/index.d.ts +0 -0
- {react → react v18.3}/ts5.0/jsx-dev-runtime.d.ts +0 -0
- {react → react v18.3}/ts5.0/jsx-runtime.d.ts +0 -0
@@ -5,10 +5,10 @@
|
|
5
5
|
This package contains type definitions for react (https://react.dev/).
|
6
6
|
|
7
7
|
# Details
|
8
|
-
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react/v18.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Thu, 05 Dec 2024 19:32:25 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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "18.3.
|
3
|
+
"version": "18.3.14",
|
4
4
|
"description": "TypeScript definitions for react",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
|
6
6
|
"license": "MIT",
|
@@ -156,22 +156,6 @@
|
|
156
156
|
"default": "./index.d.ts"
|
157
157
|
}
|
158
158
|
},
|
159
|
-
"./canary": {
|
160
|
-
"types@<=5.0": {
|
161
|
-
"default": "./ts5.0/canary.d.ts"
|
162
|
-
},
|
163
|
-
"types": {
|
164
|
-
"default": "./canary.d.ts"
|
165
|
-
}
|
166
|
-
},
|
167
|
-
"./experimental": {
|
168
|
-
"types@<=5.0": {
|
169
|
-
"default": "./ts5.0/experimental.d.ts"
|
170
|
-
},
|
171
|
-
"types": {
|
172
|
-
"default": "./experimental.d.ts"
|
173
|
-
}
|
174
|
-
},
|
175
159
|
"./jsx-runtime": {
|
176
160
|
"types@<=5.0": {
|
177
161
|
"default": "./ts5.0/jsx-runtime.d.ts"
|
@@ -201,6 +185,6 @@
|
|
201
185
|
"csstype": "^3.0.2"
|
202
186
|
},
|
203
187
|
"peerDependencies": {},
|
204
|
-
"typesPublisherContentHash": "
|
205
|
-
"typeScriptVersion": "
|
188
|
+
"typesPublisherContentHash": "99bad3e25e0b921fbfc7d8f1937c1ebd7b8ed84c76df4456953201652dc5ebac",
|
189
|
+
"typeScriptVersion": "5.0"
|
206
190
|
}
|
react/canary.d.ts
DELETED
@@ -1,166 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* These are types for things that are present in the React `canary` release channel.
|
3
|
-
*
|
4
|
-
* To load the types declared here in an actual project, there are three ways. The easiest one,
|
5
|
-
* if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
|
6
|
-
* is to add `"react/canary"` to the `"types"` array.
|
7
|
-
*
|
8
|
-
* Alternatively, a specific import syntax can to be used from a typescript file.
|
9
|
-
* This module does not exist in reality, which is why the {} is important:
|
10
|
-
*
|
11
|
-
* ```ts
|
12
|
-
* import {} from 'react/canary'
|
13
|
-
* ```
|
14
|
-
*
|
15
|
-
* It is also possible to include it through a triple-slash reference:
|
16
|
-
*
|
17
|
-
* ```ts
|
18
|
-
* /// <reference types="react/canary" />
|
19
|
-
* ```
|
20
|
-
*
|
21
|
-
* Either the import or the reference only needs to appear once, anywhere in the project.
|
22
|
-
*/
|
23
|
-
|
24
|
-
// See https://github.com/facebook/react/blob/main/packages/react/src/React.js to see how the exports are declared,
|
25
|
-
|
26
|
-
import React = require(".");
|
27
|
-
|
28
|
-
export {};
|
29
|
-
|
30
|
-
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
31
|
-
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
32
|
-
|
33
|
-
type NativeToggleEvent = ToggleEvent;
|
34
|
-
|
35
|
-
declare module "." {
|
36
|
-
export type Usable<T> = PromiseLike<T> | Context<T>;
|
37
|
-
|
38
|
-
export function use<T>(usable: Usable<T>): T;
|
39
|
-
|
40
|
-
interface ServerContextJSONArray extends ReadonlyArray<ServerContextJSONValue> {}
|
41
|
-
export type ServerContextJSONValue =
|
42
|
-
| string
|
43
|
-
| boolean
|
44
|
-
| number
|
45
|
-
| null
|
46
|
-
| ServerContextJSONArray
|
47
|
-
| { [key: string]: ServerContextJSONValue };
|
48
|
-
export interface ServerContext<T extends ServerContextJSONValue> {
|
49
|
-
Provider: Provider<T>;
|
50
|
-
}
|
51
|
-
/**
|
52
|
-
* Accepts a context object (the value returned from `React.createContext` or `React.createServerContext`) and returns the current
|
53
|
-
* context value, as given by the nearest context provider for the given context.
|
54
|
-
*
|
55
|
-
* @version 16.8.0
|
56
|
-
* @see https://react.dev/reference/react/useContext
|
57
|
-
*/
|
58
|
-
function useContext<T extends ServerContextJSONValue>(context: ServerContext<T>): T;
|
59
|
-
export function createServerContext<T extends ServerContextJSONValue>(
|
60
|
-
globalName: string,
|
61
|
-
defaultValue: T,
|
62
|
-
): ServerContext<T>;
|
63
|
-
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
65
|
-
export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
|
66
|
-
|
67
|
-
export function unstable_useCacheRefresh(): () => void;
|
68
|
-
|
69
|
-
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {
|
70
|
-
functions: (formData: FormData) => void | Promise<void>;
|
71
|
-
}
|
72
|
-
|
73
|
-
export interface TransitionStartFunction {
|
74
|
-
/**
|
75
|
-
* Marks all state updates inside the async function as transitions
|
76
|
-
*
|
77
|
-
* @see {https://react.dev/reference/react/useTransition#starttransition}
|
78
|
-
*
|
79
|
-
* @param callback
|
80
|
-
*/
|
81
|
-
(callback: () => Promise<VoidOrUndefinedOnly>): void;
|
82
|
-
}
|
83
|
-
|
84
|
-
/**
|
85
|
-
* Similar to `useTransition` but allows uses where hooks are not available.
|
86
|
-
*
|
87
|
-
* @param callback An _asynchronous_ function which causes state updates that can be deferred.
|
88
|
-
*/
|
89
|
-
export function startTransition(scope: () => Promise<VoidOrUndefinedOnly>): void;
|
90
|
-
|
91
|
-
export function useOptimistic<State>(
|
92
|
-
passthrough: State,
|
93
|
-
): [State, (action: State | ((pendingState: State) => State)) => void];
|
94
|
-
export function useOptimistic<State, Action>(
|
95
|
-
passthrough: State,
|
96
|
-
reducer: (state: State, action: Action) => State,
|
97
|
-
): [State, (action: Action) => void];
|
98
|
-
|
99
|
-
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
|
100
|
-
cleanup: () => VoidOrUndefinedOnly;
|
101
|
-
}
|
102
|
-
|
103
|
-
export function useActionState<State>(
|
104
|
-
action: (state: Awaited<State>) => State | Promise<State>,
|
105
|
-
initialState: Awaited<State>,
|
106
|
-
permalink?: string,
|
107
|
-
): [state: Awaited<State>, dispatch: () => void, isPending: boolean];
|
108
|
-
export function useActionState<State, Payload>(
|
109
|
-
action: (state: Awaited<State>, payload: Payload) => State | Promise<State>,
|
110
|
-
initialState: Awaited<State>,
|
111
|
-
permalink?: string,
|
112
|
-
): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean];
|
113
|
-
|
114
|
-
interface DOMAttributes<T> {
|
115
|
-
// Transition Events
|
116
|
-
onTransitionCancel?: TransitionEventHandler<T> | undefined;
|
117
|
-
onTransitionCancelCapture?: TransitionEventHandler<T> | undefined;
|
118
|
-
onTransitionRun?: TransitionEventHandler<T> | undefined;
|
119
|
-
onTransitionRunCapture?: TransitionEventHandler<T> | undefined;
|
120
|
-
onTransitionStart?: TransitionEventHandler<T> | undefined;
|
121
|
-
onTransitionStartCapture?: TransitionEventHandler<T> | undefined;
|
122
|
-
}
|
123
|
-
|
124
|
-
type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>;
|
125
|
-
|
126
|
-
interface HTMLAttributes<T> {
|
127
|
-
popover?: "" | "auto" | "manual" | undefined;
|
128
|
-
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
129
|
-
popoverTarget?: string | undefined;
|
130
|
-
onToggle?: ToggleEventHandler<T> | undefined;
|
131
|
-
onBeforeToggle?: ToggleEventHandler<T> | undefined;
|
132
|
-
}
|
133
|
-
|
134
|
-
interface ToggleEvent<T = Element> extends SyntheticEvent<T, NativeToggleEvent> {
|
135
|
-
oldState: "closed" | "open";
|
136
|
-
newState: "closed" | "open";
|
137
|
-
}
|
138
|
-
|
139
|
-
interface LinkHTMLAttributes<T> {
|
140
|
-
precedence?: string | undefined;
|
141
|
-
}
|
142
|
-
|
143
|
-
interface StyleHTMLAttributes<T> {
|
144
|
-
href?: string | undefined;
|
145
|
-
precedence?: string | undefined;
|
146
|
-
}
|
147
|
-
|
148
|
-
/**
|
149
|
-
* @internal Use `Awaited<ReactNode>` instead
|
150
|
-
*/
|
151
|
-
// Helper type to enable `Awaited<ReactNode>`.
|
152
|
-
// Must be a copy of the non-thenables of `ReactNode`.
|
153
|
-
type AwaitedReactNode =
|
154
|
-
| ReactElement
|
155
|
-
| string
|
156
|
-
| number
|
157
|
-
| Iterable<AwaitedReactNode>
|
158
|
-
| ReactPortal
|
159
|
-
| boolean
|
160
|
-
| null
|
161
|
-
| undefined;
|
162
|
-
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {
|
163
|
-
promises: Promise<AwaitedReactNode>;
|
164
|
-
bigints: bigint;
|
165
|
-
}
|
166
|
-
}
|
react/experimental.d.ts
DELETED
@@ -1,127 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* These are types for things that are present in the `experimental` builds of React but not yet
|
3
|
-
* on a stable build.
|
4
|
-
*
|
5
|
-
* Once they are promoted to stable they can just be moved to the main index file.
|
6
|
-
*
|
7
|
-
* To load the types declared here in an actual project, there are three ways. The easiest one,
|
8
|
-
* if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
|
9
|
-
* is to add `"react/experimental"` to the `"types"` array.
|
10
|
-
*
|
11
|
-
* Alternatively, a specific import syntax can to be used from a typescript file.
|
12
|
-
* This module does not exist in reality, which is why the {} is important:
|
13
|
-
*
|
14
|
-
* ```ts
|
15
|
-
* import {} from 'react/experimental'
|
16
|
-
* ```
|
17
|
-
*
|
18
|
-
* It is also possible to include it through a triple-slash reference:
|
19
|
-
*
|
20
|
-
* ```ts
|
21
|
-
* /// <reference types="react/experimental" />
|
22
|
-
* ```
|
23
|
-
*
|
24
|
-
* Either the import or the reference only needs to appear once, anywhere in the project.
|
25
|
-
*/
|
26
|
-
|
27
|
-
// See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared,
|
28
|
-
// and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are
|
29
|
-
// flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`.
|
30
|
-
//
|
31
|
-
// For the inputs of types exported as simply a fiber tag, the `beginWork` function of ReactFiberBeginWork.js
|
32
|
-
// is a good place to start looking for details; it generally calls prop validation functions or delegates
|
33
|
-
// all tasks done as part of the render phase (the concurrent part of the React update cycle).
|
34
|
-
//
|
35
|
-
// Suspense-related handling can be found in ReactFiberThrow.js.
|
36
|
-
|
37
|
-
import React = require("./canary");
|
38
|
-
|
39
|
-
export {};
|
40
|
-
|
41
|
-
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
42
|
-
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
43
|
-
|
44
|
-
declare module "." {
|
45
|
-
export interface SuspenseProps {
|
46
|
-
/**
|
47
|
-
* The presence of this prop indicates that the content is computationally expensive to render.
|
48
|
-
* In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
|
49
|
-
* @see {@link https://github.com/facebook/react/pull/19936}
|
50
|
-
*/
|
51
|
-
unstable_expectedLoadTime?: number | undefined;
|
52
|
-
}
|
53
|
-
|
54
|
-
export type SuspenseListRevealOrder = "forwards" | "backwards" | "together";
|
55
|
-
export type SuspenseListTailMode = "collapsed" | "hidden";
|
56
|
-
|
57
|
-
export interface SuspenseListCommonProps {
|
58
|
-
/**
|
59
|
-
* Note that SuspenseList require more than one child;
|
60
|
-
* it is a runtime warning to provide only a single child.
|
61
|
-
*
|
62
|
-
* It does, however, allow those children to be wrapped inside a single
|
63
|
-
* level of `<React.Fragment>`.
|
64
|
-
*/
|
65
|
-
children: ReactElement | Iterable<ReactElement>;
|
66
|
-
}
|
67
|
-
|
68
|
-
interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
|
69
|
-
/**
|
70
|
-
* Defines the order in which the `SuspenseList` children should be revealed.
|
71
|
-
*/
|
72
|
-
revealOrder: "forwards" | "backwards";
|
73
|
-
/**
|
74
|
-
* Dictates how unloaded items in a SuspenseList is shown.
|
75
|
-
*
|
76
|
-
* - By default, `SuspenseList` will show all fallbacks in the list.
|
77
|
-
* - `collapsed` shows only the next fallback in the list.
|
78
|
-
* - `hidden` doesn’t show any unloaded items.
|
79
|
-
*/
|
80
|
-
tail?: SuspenseListTailMode | undefined;
|
81
|
-
}
|
82
|
-
|
83
|
-
interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
|
84
|
-
/**
|
85
|
-
* Defines the order in which the `SuspenseList` children should be revealed.
|
86
|
-
*/
|
87
|
-
revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps["revealOrder"]> | undefined;
|
88
|
-
/**
|
89
|
-
* The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
|
90
|
-
*/
|
91
|
-
tail?: never | undefined;
|
92
|
-
}
|
93
|
-
|
94
|
-
export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
|
95
|
-
|
96
|
-
/**
|
97
|
-
* `SuspenseList` helps coordinate many components that can suspend by orchestrating the order
|
98
|
-
* in which these components are revealed to the user.
|
99
|
-
*
|
100
|
-
* When multiple components need to fetch data, this data may arrive in an unpredictable order.
|
101
|
-
* However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
|
102
|
-
* until previous items have been displayed (this behavior is adjustable).
|
103
|
-
*
|
104
|
-
* @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
|
105
|
-
* @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
|
106
|
-
*/
|
107
|
-
export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
|
108
|
-
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
110
|
-
export function experimental_useEffectEvent<T extends Function>(event: T): T;
|
111
|
-
|
112
|
-
type Reference = object;
|
113
|
-
type TaintableUniqueValue = string | bigint | ArrayBufferView;
|
114
|
-
function experimental_taintUniqueValue(
|
115
|
-
message: string | undefined,
|
116
|
-
lifetime: Reference,
|
117
|
-
value: TaintableUniqueValue,
|
118
|
-
): void;
|
119
|
-
function experimental_taintObjectReference(message: string | undefined, object: Reference): void;
|
120
|
-
|
121
|
-
export interface HTMLAttributes<T> {
|
122
|
-
/**
|
123
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
|
124
|
-
*/
|
125
|
-
inert?: boolean | undefined;
|
126
|
-
}
|
127
|
-
}
|
react/ts5.0/canary.d.ts
DELETED
@@ -1,166 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* These are types for things that are present in the React `canary` release channel.
|
3
|
-
*
|
4
|
-
* To load the types declared here in an actual project, there are three ways. The easiest one,
|
5
|
-
* if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
|
6
|
-
* is to add `"react/canary"` to the `"types"` array.
|
7
|
-
*
|
8
|
-
* Alternatively, a specific import syntax can to be used from a typescript file.
|
9
|
-
* This module does not exist in reality, which is why the {} is important:
|
10
|
-
*
|
11
|
-
* ```ts
|
12
|
-
* import {} from 'react/canary'
|
13
|
-
* ```
|
14
|
-
*
|
15
|
-
* It is also possible to include it through a triple-slash reference:
|
16
|
-
*
|
17
|
-
* ```ts
|
18
|
-
* /// <reference types="react/canary" />
|
19
|
-
* ```
|
20
|
-
*
|
21
|
-
* Either the import or the reference only needs to appear once, anywhere in the project.
|
22
|
-
*/
|
23
|
-
|
24
|
-
// See https://github.com/facebook/react/blob/main/packages/react/src/React.js to see how the exports are declared,
|
25
|
-
|
26
|
-
import React = require(".");
|
27
|
-
|
28
|
-
export {};
|
29
|
-
|
30
|
-
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
31
|
-
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
32
|
-
|
33
|
-
type NativeToggleEvent = ToggleEvent;
|
34
|
-
|
35
|
-
declare module "." {
|
36
|
-
export type Usable<T> = PromiseLike<T> | Context<T>;
|
37
|
-
|
38
|
-
export function use<T>(usable: Usable<T>): T;
|
39
|
-
|
40
|
-
interface ServerContextJSONArray extends ReadonlyArray<ServerContextJSONValue> {}
|
41
|
-
export type ServerContextJSONValue =
|
42
|
-
| string
|
43
|
-
| boolean
|
44
|
-
| number
|
45
|
-
| null
|
46
|
-
| ServerContextJSONArray
|
47
|
-
| { [key: string]: ServerContextJSONValue };
|
48
|
-
export interface ServerContext<T extends ServerContextJSONValue> {
|
49
|
-
Provider: Provider<T>;
|
50
|
-
}
|
51
|
-
/**
|
52
|
-
* Accepts a context object (the value returned from `React.createContext` or `React.createServerContext`) and returns the current
|
53
|
-
* context value, as given by the nearest context provider for the given context.
|
54
|
-
*
|
55
|
-
* @version 16.8.0
|
56
|
-
* @see https://react.dev/reference/react/useContext
|
57
|
-
*/
|
58
|
-
function useContext<T extends ServerContextJSONValue>(context: ServerContext<T>): T;
|
59
|
-
export function createServerContext<T extends ServerContextJSONValue>(
|
60
|
-
globalName: string,
|
61
|
-
defaultValue: T,
|
62
|
-
): ServerContext<T>;
|
63
|
-
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
65
|
-
export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction;
|
66
|
-
|
67
|
-
export function unstable_useCacheRefresh(): () => void;
|
68
|
-
|
69
|
-
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {
|
70
|
-
functions: (formData: FormData) => void | Promise<void>;
|
71
|
-
}
|
72
|
-
|
73
|
-
export interface TransitionStartFunction {
|
74
|
-
/**
|
75
|
-
* Marks all state updates inside the async function as transitions
|
76
|
-
*
|
77
|
-
* @see {https://react.dev/reference/react/useTransition#starttransition}
|
78
|
-
*
|
79
|
-
* @param callback
|
80
|
-
*/
|
81
|
-
(callback: () => Promise<VoidOrUndefinedOnly>): void;
|
82
|
-
}
|
83
|
-
|
84
|
-
/**
|
85
|
-
* Similar to `useTransition` but allows uses where hooks are not available.
|
86
|
-
*
|
87
|
-
* @param callback An _asynchronous_ function which causes state updates that can be deferred.
|
88
|
-
*/
|
89
|
-
export function startTransition(scope: () => Promise<VoidOrUndefinedOnly>): void;
|
90
|
-
|
91
|
-
export function useOptimistic<State>(
|
92
|
-
passthrough: State,
|
93
|
-
): [State, (action: State | ((pendingState: State) => State)) => void];
|
94
|
-
export function useOptimistic<State, Action>(
|
95
|
-
passthrough: State,
|
96
|
-
reducer: (state: State, action: Action) => State,
|
97
|
-
): [State, (action: Action) => void];
|
98
|
-
|
99
|
-
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES {
|
100
|
-
cleanup: () => VoidOrUndefinedOnly;
|
101
|
-
}
|
102
|
-
|
103
|
-
export function useActionState<State>(
|
104
|
-
action: (state: Awaited<State>) => State | Promise<State>,
|
105
|
-
initialState: Awaited<State>,
|
106
|
-
permalink?: string,
|
107
|
-
): [state: Awaited<State>, dispatch: () => void, isPending: boolean];
|
108
|
-
export function useActionState<State, Payload>(
|
109
|
-
action: (state: Awaited<State>, payload: Payload) => State | Promise<State>,
|
110
|
-
initialState: Awaited<State>,
|
111
|
-
permalink?: string,
|
112
|
-
): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean];
|
113
|
-
|
114
|
-
interface DOMAttributes<T> {
|
115
|
-
// Transition Events
|
116
|
-
onTransitionCancel?: TransitionEventHandler<T> | undefined;
|
117
|
-
onTransitionCancelCapture?: TransitionEventHandler<T> | undefined;
|
118
|
-
onTransitionRun?: TransitionEventHandler<T> | undefined;
|
119
|
-
onTransitionRunCapture?: TransitionEventHandler<T> | undefined;
|
120
|
-
onTransitionStart?: TransitionEventHandler<T> | undefined;
|
121
|
-
onTransitionStartCapture?: TransitionEventHandler<T> | undefined;
|
122
|
-
}
|
123
|
-
|
124
|
-
type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>;
|
125
|
-
|
126
|
-
interface HTMLAttributes<T> {
|
127
|
-
popover?: "" | "auto" | "manual" | undefined;
|
128
|
-
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
129
|
-
popoverTarget?: string | undefined;
|
130
|
-
onToggle?: ToggleEventHandler<T> | undefined;
|
131
|
-
onBeforeToggle?: ToggleEventHandler<T> | undefined;
|
132
|
-
}
|
133
|
-
|
134
|
-
interface ToggleEvent<T = Element> extends SyntheticEvent<T, NativeToggleEvent> {
|
135
|
-
oldState: "closed" | "open";
|
136
|
-
newState: "closed" | "open";
|
137
|
-
}
|
138
|
-
|
139
|
-
interface LinkHTMLAttributes<T> {
|
140
|
-
precedence?: string | undefined;
|
141
|
-
}
|
142
|
-
|
143
|
-
interface StyleHTMLAttributes<T> {
|
144
|
-
href?: string | undefined;
|
145
|
-
precedence?: string | undefined;
|
146
|
-
}
|
147
|
-
|
148
|
-
/**
|
149
|
-
* @internal Use `Awaited<ReactNode>` instead
|
150
|
-
*/
|
151
|
-
// Helper type to enable `Awaited<ReactNode>`.
|
152
|
-
// Must be a copy of the non-thenables of `ReactNode`.
|
153
|
-
type AwaitedReactNode =
|
154
|
-
| ReactElement
|
155
|
-
| string
|
156
|
-
| number
|
157
|
-
| Iterable<AwaitedReactNode>
|
158
|
-
| ReactPortal
|
159
|
-
| boolean
|
160
|
-
| null
|
161
|
-
| undefined;
|
162
|
-
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {
|
163
|
-
promises: Promise<AwaitedReactNode>;
|
164
|
-
bigints: bigint;
|
165
|
-
}
|
166
|
-
}
|
react/ts5.0/experimental.d.ts
DELETED
@@ -1,127 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* These are types for things that are present in the `experimental` builds of React but not yet
|
3
|
-
* on a stable build.
|
4
|
-
*
|
5
|
-
* Once they are promoted to stable they can just be moved to the main index file.
|
6
|
-
*
|
7
|
-
* To load the types declared here in an actual project, there are three ways. The easiest one,
|
8
|
-
* if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
|
9
|
-
* is to add `"react/experimental"` to the `"types"` array.
|
10
|
-
*
|
11
|
-
* Alternatively, a specific import syntax can to be used from a typescript file.
|
12
|
-
* This module does not exist in reality, which is why the {} is important:
|
13
|
-
*
|
14
|
-
* ```ts
|
15
|
-
* import {} from 'react/experimental'
|
16
|
-
* ```
|
17
|
-
*
|
18
|
-
* It is also possible to include it through a triple-slash reference:
|
19
|
-
*
|
20
|
-
* ```ts
|
21
|
-
* /// <reference types="react/experimental" />
|
22
|
-
* ```
|
23
|
-
*
|
24
|
-
* Either the import or the reference only needs to appear once, anywhere in the project.
|
25
|
-
*/
|
26
|
-
|
27
|
-
// See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared,
|
28
|
-
// and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are
|
29
|
-
// flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`.
|
30
|
-
//
|
31
|
-
// For the inputs of types exported as simply a fiber tag, the `beginWork` function of ReactFiberBeginWork.js
|
32
|
-
// is a good place to start looking for details; it generally calls prop validation functions or delegates
|
33
|
-
// all tasks done as part of the render phase (the concurrent part of the React update cycle).
|
34
|
-
//
|
35
|
-
// Suspense-related handling can be found in ReactFiberThrow.js.
|
36
|
-
|
37
|
-
import React = require("./canary");
|
38
|
-
|
39
|
-
export {};
|
40
|
-
|
41
|
-
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
42
|
-
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
43
|
-
|
44
|
-
declare module "." {
|
45
|
-
export interface SuspenseProps {
|
46
|
-
/**
|
47
|
-
* The presence of this prop indicates that the content is computationally expensive to render.
|
48
|
-
* In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
|
49
|
-
* @see {@link https://github.com/facebook/react/pull/19936}
|
50
|
-
*/
|
51
|
-
unstable_expectedLoadTime?: number | undefined;
|
52
|
-
}
|
53
|
-
|
54
|
-
export type SuspenseListRevealOrder = "forwards" | "backwards" | "together";
|
55
|
-
export type SuspenseListTailMode = "collapsed" | "hidden";
|
56
|
-
|
57
|
-
export interface SuspenseListCommonProps {
|
58
|
-
/**
|
59
|
-
* Note that SuspenseList require more than one child;
|
60
|
-
* it is a runtime warning to provide only a single child.
|
61
|
-
*
|
62
|
-
* It does, however, allow those children to be wrapped inside a single
|
63
|
-
* level of `<React.Fragment>`.
|
64
|
-
*/
|
65
|
-
children: ReactElement | Iterable<ReactElement>;
|
66
|
-
}
|
67
|
-
|
68
|
-
interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
|
69
|
-
/**
|
70
|
-
* Defines the order in which the `SuspenseList` children should be revealed.
|
71
|
-
*/
|
72
|
-
revealOrder: "forwards" | "backwards";
|
73
|
-
/**
|
74
|
-
* Dictates how unloaded items in a SuspenseList is shown.
|
75
|
-
*
|
76
|
-
* - By default, `SuspenseList` will show all fallbacks in the list.
|
77
|
-
* - `collapsed` shows only the next fallback in the list.
|
78
|
-
* - `hidden` doesn’t show any unloaded items.
|
79
|
-
*/
|
80
|
-
tail?: SuspenseListTailMode | undefined;
|
81
|
-
}
|
82
|
-
|
83
|
-
interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
|
84
|
-
/**
|
85
|
-
* Defines the order in which the `SuspenseList` children should be revealed.
|
86
|
-
*/
|
87
|
-
revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps["revealOrder"]> | undefined;
|
88
|
-
/**
|
89
|
-
* The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
|
90
|
-
*/
|
91
|
-
tail?: never | undefined;
|
92
|
-
}
|
93
|
-
|
94
|
-
export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
|
95
|
-
|
96
|
-
/**
|
97
|
-
* `SuspenseList` helps coordinate many components that can suspend by orchestrating the order
|
98
|
-
* in which these components are revealed to the user.
|
99
|
-
*
|
100
|
-
* When multiple components need to fetch data, this data may arrive in an unpredictable order.
|
101
|
-
* However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
|
102
|
-
* until previous items have been displayed (this behavior is adjustable).
|
103
|
-
*
|
104
|
-
* @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
|
105
|
-
* @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
|
106
|
-
*/
|
107
|
-
export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
|
108
|
-
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
110
|
-
export function experimental_useEffectEvent<T extends Function>(event: T): T;
|
111
|
-
|
112
|
-
type Reference = object;
|
113
|
-
type TaintableUniqueValue = string | bigint | ArrayBufferView;
|
114
|
-
function experimental_taintUniqueValue(
|
115
|
-
message: string | undefined,
|
116
|
-
lifetime: Reference,
|
117
|
-
value: TaintableUniqueValue,
|
118
|
-
): void;
|
119
|
-
function experimental_taintObjectReference(message: string | undefined, object: Reference): void;
|
120
|
-
|
121
|
-
export interface HTMLAttributes<T> {
|
122
|
-
/**
|
123
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
|
124
|
-
*/
|
125
|
-
inert?: boolean | undefined;
|
126
|
-
}
|
127
|
-
}
|
{react → react v18.3}/LICENSE
RENAMED
File without changes
|
File without changes
|
{react → react v18.3}/index.d.ts
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|