@types/react-dom 18.2.6 → 18.2.8
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-dom/LICENSE +0 -0
- react-dom/README.md +1 -1
- react-dom/canary.d.ts +5 -5
- react-dom/client.d.ts +1 -1
- react-dom/experimental.d.ts +3 -3
- react-dom/index.d.ts +36 -22
- react-dom/package.json +3 -3
- react-dom/server.d.ts +3 -3
- react-dom/test-utils/index.d.ts +70 -25
react-dom/LICENSE
CHANGED
File without changes
|
react-dom/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for React (react-dom) (https://reactjs.or
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Wed, 27 Sep 2023 07:12:04 GMT
|
12
12
|
* Dependencies: [@types/react](https://npmjs.com/package/@types/react)
|
13
13
|
* Global values: `ReactDOM`, `ReactDOMServer`
|
14
14
|
|
react-dom/canary.d.ts
CHANGED
@@ -26,13 +26,13 @@
|
|
26
26
|
// See https://github.com/facebook/react/blob/main/packages/react-dom/index.js to see how the exports are declared,
|
27
27
|
// but confirm with published source code (e.g. https://unpkg.com/react-dom@canary) that these exports end up in the published code
|
28
28
|
|
29
|
-
import React = require(
|
30
|
-
import ReactDOM = require(
|
29
|
+
import React = require("react");
|
30
|
+
import ReactDOM = require(".");
|
31
31
|
|
32
32
|
export {};
|
33
33
|
|
34
|
-
declare module
|
35
|
-
type PreloadAs =
|
34
|
+
declare module "." {
|
35
|
+
type PreloadAs = "font" | "script" | "style";
|
36
36
|
interface PreloadOptions {
|
37
37
|
as: PreloadAs;
|
38
38
|
crossOrigin?: string | undefined;
|
@@ -40,7 +40,7 @@ declare module '.' {
|
|
40
40
|
}
|
41
41
|
function preload(href: string, options?: PreloadOptions): void;
|
42
42
|
|
43
|
-
type PreinitAs =
|
43
|
+
type PreinitAs = "script" | "style";
|
44
44
|
interface PreinitOptions {
|
45
45
|
as: PreinitAs;
|
46
46
|
crossOrigin?: string | undefined;
|
react-dom/client.d.ts
CHANGED
react-dom/experimental.d.ts
CHANGED
@@ -27,12 +27,12 @@
|
|
27
27
|
// See https://github.com/facebook/react/blob/main/packages/react-dom/index.experimental.js to see how the exports are declared,
|
28
28
|
// but confirm with published source code (e.g. https://unpkg.com/react-dom@experimental) that these exports end up in the published code
|
29
29
|
|
30
|
-
import React = require(
|
31
|
-
import ReactDOM = require(
|
30
|
+
import React = require("react");
|
31
|
+
import ReactDOM = require("./canary");
|
32
32
|
|
33
33
|
export {};
|
34
34
|
|
35
|
-
declare module
|
35
|
+
declare module "." {
|
36
36
|
interface FormStatusNotPending {
|
37
37
|
pending: false;
|
38
38
|
data: null;
|
react-dom/index.d.ts
CHANGED
@@ -17,15 +17,26 @@
|
|
17
17
|
export as namespace ReactDOM;
|
18
18
|
|
19
19
|
import {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
CElement,
|
21
|
+
Component,
|
22
|
+
ComponentState,
|
23
|
+
DOMAttributes,
|
24
|
+
DOMElement,
|
25
|
+
FunctionComponentElement,
|
26
|
+
ReactElement,
|
27
|
+
ReactInstance,
|
28
|
+
ReactNode,
|
29
|
+
ReactPortal,
|
30
|
+
} from "react";
|
24
31
|
|
25
32
|
export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text;
|
26
33
|
export function unmountComponentAtNode(container: Element | DocumentFragment): boolean;
|
27
34
|
|
28
|
-
export function createPortal(
|
35
|
+
export function createPortal(
|
36
|
+
children: ReactNode,
|
37
|
+
container: Element | DocumentFragment,
|
38
|
+
key?: null | string,
|
39
|
+
): ReactPortal;
|
29
40
|
|
30
41
|
export const version: string;
|
31
42
|
export const render: Renderer;
|
@@ -41,17 +52,20 @@ export function unstable_renderSubtreeIntoContainer<T extends Element>(
|
|
41
52
|
parentComponent: Component<any>,
|
42
53
|
element: DOMElement<DOMAttributes<T>, T>,
|
43
54
|
container: Element,
|
44
|
-
callback?: (element: T) => any
|
55
|
+
callback?: (element: T) => any,
|
56
|
+
): T;
|
45
57
|
export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>(
|
46
58
|
parentComponent: Component<any>,
|
47
59
|
element: CElement<P, T>,
|
48
60
|
container: Element,
|
49
|
-
callback?: (component: T) => any
|
61
|
+
callback?: (component: T) => any,
|
62
|
+
): T;
|
50
63
|
export function unstable_renderSubtreeIntoContainer<P>(
|
51
64
|
parentComponent: Component<any>,
|
52
65
|
element: ReactElement<P>,
|
53
66
|
container: Element,
|
54
|
-
callback?: (component?: Component<P, ComponentState> | Element) => any
|
67
|
+
callback?: (component?: Component<P, ComponentState> | Element) => any,
|
68
|
+
): Component<P, ComponentState> | Element | void;
|
55
69
|
|
56
70
|
export type Container = Element | Document | DocumentFragment;
|
57
71
|
|
@@ -61,43 +75,43 @@ export interface Renderer {
|
|
61
75
|
|
62
76
|
<T extends Element>(
|
63
77
|
element: DOMElement<DOMAttributes<T>, T>,
|
64
|
-
container: Container| null,
|
65
|
-
callback?: () => void
|
78
|
+
container: Container | null,
|
79
|
+
callback?: () => void,
|
66
80
|
): T;
|
67
81
|
|
68
82
|
(
|
69
83
|
element: Array<DOMElement<DOMAttributes<any>, any>>,
|
70
|
-
container: Container| null,
|
71
|
-
callback?: () => void
|
84
|
+
container: Container | null,
|
85
|
+
callback?: () => void,
|
72
86
|
): Element;
|
73
87
|
|
74
88
|
(
|
75
89
|
element: FunctionComponentElement<any> | Array<FunctionComponentElement<any>>,
|
76
|
-
container: Container| null,
|
77
|
-
callback?: () => void
|
90
|
+
container: Container | null,
|
91
|
+
callback?: () => void,
|
78
92
|
): void;
|
79
93
|
|
80
94
|
<P, T extends Component<P, ComponentState>>(
|
81
95
|
element: CElement<P, T>,
|
82
|
-
container: Container| null,
|
83
|
-
callback?: () => void
|
96
|
+
container: Container | null,
|
97
|
+
callback?: () => void,
|
84
98
|
): T;
|
85
99
|
|
86
100
|
(
|
87
101
|
element: Array<CElement<any, Component<any, ComponentState>>>,
|
88
|
-
container: Container| null,
|
89
|
-
callback?: () => void
|
102
|
+
container: Container | null,
|
103
|
+
callback?: () => void,
|
90
104
|
): Component<any, ComponentState>;
|
91
105
|
|
92
106
|
<P>(
|
93
107
|
element: ReactElement<P>,
|
94
|
-
container: Container| null,
|
95
|
-
callback?: () => void
|
108
|
+
container: Container | null,
|
109
|
+
callback?: () => void,
|
96
110
|
): Component<P, ComponentState> | Element | void;
|
97
111
|
|
98
112
|
(
|
99
113
|
element: ReactElement[],
|
100
|
-
container: Container| null,
|
101
|
-
callback?: () => void
|
114
|
+
container: Container | null,
|
115
|
+
callback?: () => void,
|
102
116
|
): Component<any, ComponentState> | Element | void;
|
103
117
|
}
|
react-dom/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react-dom",
|
3
|
-
"version": "18.2.
|
3
|
+
"version": "18.2.8",
|
4
4
|
"description": "TypeScript definitions for React (react-dom)",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom",
|
6
6
|
"license": "MIT",
|
@@ -49,8 +49,8 @@
|
|
49
49
|
"dependencies": {
|
50
50
|
"@types/react": "*"
|
51
51
|
},
|
52
|
-
"typesPublisherContentHash": "
|
53
|
-
"typeScriptVersion": "4.
|
52
|
+
"typesPublisherContentHash": "f37f361aad53e3f7a39972574a1b1cab2abe083c8bf24b0529d11877c5e0f940",
|
53
|
+
"typeScriptVersion": "4.5",
|
54
54
|
"exports": {
|
55
55
|
".": {
|
56
56
|
"types": {
|
react-dom/server.d.ts
CHANGED
@@ -21,8 +21,8 @@ declare global {
|
|
21
21
|
interface ReadableStream {}
|
22
22
|
}
|
23
23
|
|
24
|
-
import { ReactElement, ReactNode } from
|
25
|
-
import { ErrorInfo } from
|
24
|
+
import { ReactElement, ReactNode } from "react";
|
25
|
+
import { ErrorInfo } from "./client";
|
26
26
|
|
27
27
|
export interface RenderToPipeableStreamOptions {
|
28
28
|
identifierPrefix?: string;
|
@@ -39,7 +39,7 @@ export interface RenderToPipeableStreamOptions {
|
|
39
39
|
}
|
40
40
|
|
41
41
|
export interface PipeableStream {
|
42
|
-
abort: () => void;
|
42
|
+
abort: (reason?: unknown) => void;
|
43
43
|
pipe: <Writable extends NodeJS.WritableStream>(destination: Writable) => Writable;
|
44
44
|
}
|
45
45
|
|
react-dom/test-utils/index.d.ts
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
import {
|
2
|
-
AbstractView,
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
AbstractView,
|
3
|
+
CElement,
|
4
|
+
ClassType,
|
5
|
+
Component,
|
6
|
+
ComponentClass,
|
7
|
+
DOMAttributes,
|
8
|
+
DOMElement,
|
9
|
+
FC,
|
10
|
+
FunctionComponentElement,
|
11
|
+
ReactElement,
|
12
|
+
ReactHTMLElement,
|
13
|
+
ReactInstance,
|
14
|
+
} from "react";
|
7
15
|
|
8
16
|
import * as ReactTestUtils from ".";
|
9
17
|
|
@@ -24,7 +32,21 @@ export interface OptionalEventProperties {
|
|
24
32
|
type?: string | undefined;
|
25
33
|
}
|
26
34
|
|
27
|
-
export type ModifierKey =
|
35
|
+
export type ModifierKey =
|
36
|
+
| "Alt"
|
37
|
+
| "AltGraph"
|
38
|
+
| "CapsLock"
|
39
|
+
| "Control"
|
40
|
+
| "Fn"
|
41
|
+
| "FnLock"
|
42
|
+
| "Hyper"
|
43
|
+
| "Meta"
|
44
|
+
| "NumLock"
|
45
|
+
| "ScrollLock"
|
46
|
+
| "Shift"
|
47
|
+
| "Super"
|
48
|
+
| "Symbol"
|
49
|
+
| "SymbolLock";
|
28
50
|
|
29
51
|
export interface SyntheticEventData extends OptionalEventProperties {
|
30
52
|
altKey?: boolean | undefined;
|
@@ -63,7 +85,7 @@ export interface SyntheticEventData extends OptionalEventProperties {
|
|
63
85
|
export type EventSimulator = (element: Element | Component<any>, eventData?: SyntheticEventData) => void;
|
64
86
|
|
65
87
|
export interface MockedComponentClass {
|
66
|
-
new
|
88
|
+
new(props: any): any;
|
67
89
|
}
|
68
90
|
|
69
91
|
export interface ShallowRenderer {
|
@@ -82,7 +104,7 @@ export interface ShallowRenderer {
|
|
82
104
|
* Simulate an event dispatch on a DOM node with optional `eventData` event data.
|
83
105
|
* `Simulate` has a method for every event that React understands.
|
84
106
|
*/
|
85
|
-
|
107
|
+
export namespace Simulate {
|
86
108
|
const abort: EventSimulator;
|
87
109
|
const animationEnd: EventSimulator;
|
88
110
|
const animationIteration: EventSimulator;
|
@@ -174,17 +196,21 @@ export interface ShallowRenderer {
|
|
174
196
|
* Render a React element into a detached DOM node in the document. __This function requires a DOM__.
|
175
197
|
*/
|
176
198
|
export function renderIntoDocument<T extends Element>(
|
177
|
-
element: DOMElement<any, T
|
199
|
+
element: DOMElement<any, T>,
|
200
|
+
): T;
|
178
201
|
export function renderIntoDocument(
|
179
|
-
element: FunctionComponentElement<any
|
202
|
+
element: FunctionComponentElement<any>,
|
203
|
+
): void;
|
180
204
|
// If we replace `P` with `any` in this overload, then some tests fail because
|
181
205
|
// calls to `renderIntoDocument` choose the last overload on the
|
182
206
|
// subtype-relation pass and get an undesirably broad return type. Using `P`
|
183
207
|
// allows this overload to match on the subtype-relation pass.
|
184
208
|
export function renderIntoDocument<P, T extends Component<P>>(
|
185
|
-
element: CElement<P, T
|
209
|
+
element: CElement<P, T>,
|
210
|
+
): T;
|
186
211
|
export function renderIntoDocument<P>(
|
187
|
-
element: ReactElement<P
|
212
|
+
element: ReactElement<P>,
|
213
|
+
): Component<P> | Element | void;
|
188
214
|
|
189
215
|
/**
|
190
216
|
* Pass a mocked component module to this method to augment it with useful methods that allow it to
|
@@ -192,7 +218,9 @@ export function renderIntoDocument<P>(
|
|
192
218
|
* a simple `<div>` (or other tag if `mockTagName` is provided) containing any provided children.
|
193
219
|
*/
|
194
220
|
export function mockComponent(
|
195
|
-
mocked: MockedComponentClass,
|
221
|
+
mocked: MockedComponentClass,
|
222
|
+
mockTagName?: string,
|
223
|
+
): typeof ReactTestUtils;
|
196
224
|
|
197
225
|
/**
|
198
226
|
* Returns `true` if `element` is any React element.
|
@@ -203,22 +231,30 @@ export function isElement(element: any): boolean;
|
|
203
231
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
204
232
|
*/
|
205
233
|
export function isElementOfType<T extends HTMLElement>(
|
206
|
-
element: ReactElement,
|
234
|
+
element: ReactElement,
|
235
|
+
type: string,
|
236
|
+
): element is ReactHTMLElement<T>;
|
207
237
|
/**
|
208
238
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
209
239
|
*/
|
210
240
|
export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>(
|
211
|
-
element: ReactElement,
|
241
|
+
element: ReactElement,
|
242
|
+
type: string,
|
243
|
+
): element is DOMElement<P, T>;
|
212
244
|
/**
|
213
245
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
214
246
|
*/
|
215
247
|
export function isElementOfType<P>(
|
216
|
-
element: ReactElement,
|
248
|
+
element: ReactElement,
|
249
|
+
type: FC<P>,
|
250
|
+
): element is FunctionComponentElement<P>;
|
217
251
|
/**
|
218
252
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
219
253
|
*/
|
220
254
|
export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>(
|
221
|
-
element: ReactElement,
|
255
|
+
element: ReactElement,
|
256
|
+
type: ClassType<P, T, C>,
|
257
|
+
): element is CElement<P, T>;
|
222
258
|
|
223
259
|
/**
|
224
260
|
* Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
|
@@ -232,7 +268,9 @@ export function isCompositeComponent(instance: ReactInstance): instance is Compo
|
|
232
268
|
* Returns `true` if `instance` is a component whose type is of a React `componentClass`.
|
233
269
|
*/
|
234
270
|
export function isCompositeComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
|
235
|
-
instance: ReactInstance,
|
271
|
+
instance: ReactInstance,
|
272
|
+
type: ClassType<any, T, C>,
|
273
|
+
): boolean;
|
236
274
|
|
237
275
|
/**
|
238
276
|
* Traverse all components in `tree` and accumulate all components where
|
@@ -241,7 +279,8 @@ export function isCompositeComponentWithType<T extends Component<any>, C extends
|
|
241
279
|
*/
|
242
280
|
export function findAllInRenderedTree(
|
243
281
|
root: Component<any>,
|
244
|
-
fn: (i: ReactInstance) => boolean
|
282
|
+
fn: (i: ReactInstance) => boolean,
|
283
|
+
): ReactInstance[];
|
245
284
|
|
246
285
|
/**
|
247
286
|
* Finds all DOM elements of components in the rendered tree that are
|
@@ -249,7 +288,8 @@ export function findAllInRenderedTree(
|
|
249
288
|
*/
|
250
289
|
export function scryRenderedDOMComponentsWithClass(
|
251
290
|
root: Component<any>,
|
252
|
-
className: string
|
291
|
+
className: string,
|
292
|
+
): Element[];
|
253
293
|
/**
|
254
294
|
* Like `scryRenderedDOMComponentsWithClass()` but expects there to be one result,
|
255
295
|
* and returns that one result, or throws exception if there is any other
|
@@ -257,7 +297,8 @@ export function scryRenderedDOMComponentsWithClass(
|
|
257
297
|
*/
|
258
298
|
export function findRenderedDOMComponentWithClass(
|
259
299
|
root: Component<any>,
|
260
|
-
className: string
|
300
|
+
className: string,
|
301
|
+
): Element;
|
261
302
|
|
262
303
|
/**
|
263
304
|
* Finds all DOM elements of components in the rendered tree that are
|
@@ -265,7 +306,8 @@ export function findRenderedDOMComponentWithClass(
|
|
265
306
|
*/
|
266
307
|
export function scryRenderedDOMComponentsWithTag(
|
267
308
|
root: Component<any>,
|
268
|
-
tagName: string
|
309
|
+
tagName: string,
|
310
|
+
): Element[];
|
269
311
|
/**
|
270
312
|
* Like `scryRenderedDOMComponentsWithTag()` but expects there to be one result,
|
271
313
|
* and returns that one result, or throws exception if there is any other
|
@@ -273,14 +315,16 @@ export function scryRenderedDOMComponentsWithTag(
|
|
273
315
|
*/
|
274
316
|
export function findRenderedDOMComponentWithTag(
|
275
317
|
root: Component<any>,
|
276
|
-
tagName: string
|
318
|
+
tagName: string,
|
319
|
+
): Element;
|
277
320
|
|
278
321
|
/**
|
279
322
|
* Finds all instances of components with type equal to `componentClass`.
|
280
323
|
*/
|
281
324
|
export function scryRenderedComponentsWithType<T extends Component<any>, C extends ComponentClass<any>>(
|
282
325
|
root: Component<any>,
|
283
|
-
type: ClassType<any, T, C
|
326
|
+
type: ClassType<any, T, C>,
|
327
|
+
): T[];
|
284
328
|
|
285
329
|
/**
|
286
330
|
* Same as `scryRenderedComponentsWithType()` but expects there to be one result
|
@@ -289,7 +333,8 @@ export function scryRenderedComponentsWithType<T extends Component<any>, C exten
|
|
289
333
|
*/
|
290
334
|
export function findRenderedComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
|
291
335
|
root: Component<any>,
|
292
|
-
type: ClassType<any, T, C
|
336
|
+
type: ClassType<any, T, C>,
|
337
|
+
): T;
|
293
338
|
|
294
339
|
/**
|
295
340
|
* Call this in your tests to create a shallow renderer.
|