@types/react-dom 16.9.19 → 16.9.21
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 v16.9/LICENSE +0 -0
- react-dom v16.9/README.md +2 -3
- react-dom v16.9/index.d.ts +35 -33
- react-dom v16.9/package.json +12 -12
- react-dom v16.9/server/index.d.ts +1 -1
- react-dom v16.9/test-utils/index.d.ts +70 -25
react-dom v16.9/LICENSE
CHANGED
File without changes
|
react-dom v16.9/README.md
CHANGED
@@ -2,15 +2,14 @@
|
|
2
2
|
> `npm install --save @types/react-dom`
|
3
3
|
|
4
4
|
# Summary
|
5
|
-
This package contains type definitions for
|
5
|
+
This package contains type definitions for react-dom (https://reactjs.org).
|
6
6
|
|
7
7
|
# Details
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom/v16.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Wed, 18 Oct 2023 18:04:04 GMT
|
12
12
|
* Dependencies: [@types/react](https://npmjs.com/package/@types/react)
|
13
|
-
* Global values: `ReactDOM`, `ReactDOMServer`
|
14
13
|
|
15
14
|
# Credits
|
16
15
|
These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [MartynasZilinskas](https://github.com/MartynasZilinskas), [Josh Rutherford](https://github.com/theruther4d), [Jessica Franco](https://github.com/Jessidhia), and [Sebastian Silbermann](https://github.com/eps1lon).
|
react-dom v16.9/index.d.ts
CHANGED
@@ -1,15 +1,3 @@
|
|
1
|
-
// Type definitions for React (react-dom) 16.9
|
2
|
-
// Project: https://reactjs.org
|
3
|
-
// Definitions by: Asana <https://asana.com>
|
4
|
-
// AssureSign <http://www.assuresign.com>
|
5
|
-
// Microsoft <https://microsoft.com>
|
6
|
-
// MartynasZilinskas <https://github.com/MartynasZilinskas>
|
7
|
-
// Josh Rutherford <https://github.com/theruther4d>
|
8
|
-
// Jessica Franco <https://github.com/Jessidhia>
|
9
|
-
// Sebastian Silbermann <https://github.com/eps1lon>
|
10
|
-
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
11
|
-
// TypeScript Version: 2.8
|
12
|
-
|
13
1
|
// NOTE: Users of the `experimental` builds of React should add a reference
|
14
2
|
// to 'react-dom/experimental' in their project. See experimental.d.ts's top comment
|
15
3
|
// for reference and documentation on how exactly to do it.
|
@@ -17,15 +5,26 @@
|
|
17
5
|
export as namespace ReactDOM;
|
18
6
|
|
19
7
|
import {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
8
|
+
CElement,
|
9
|
+
Component,
|
10
|
+
ComponentState,
|
11
|
+
DOMAttributes,
|
12
|
+
DOMElement,
|
13
|
+
ReactElement,
|
14
|
+
ReactInstance,
|
15
|
+
ReactNode,
|
16
|
+
ReactPortal,
|
17
|
+
SFCElement,
|
18
|
+
} from "react";
|
24
19
|
|
25
20
|
export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text;
|
26
21
|
export function unmountComponentAtNode(container: Element | DocumentFragment): boolean;
|
27
22
|
|
28
|
-
export function createPortal(
|
23
|
+
export function createPortal(
|
24
|
+
children: ReactNode,
|
25
|
+
container: Element | DocumentFragment,
|
26
|
+
key?: null | string,
|
27
|
+
): ReactPortal;
|
29
28
|
|
30
29
|
export const version: string;
|
31
30
|
export const render: Renderer;
|
@@ -41,17 +40,20 @@ export function unstable_renderSubtreeIntoContainer<T extends Element>(
|
|
41
40
|
parentComponent: Component<any>,
|
42
41
|
element: DOMElement<DOMAttributes<T>, T>,
|
43
42
|
container: Element,
|
44
|
-
callback?: (element: T) => any
|
43
|
+
callback?: (element: T) => any,
|
44
|
+
): T;
|
45
45
|
export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>(
|
46
46
|
parentComponent: Component<any>,
|
47
47
|
element: CElement<P, T>,
|
48
48
|
container: Element,
|
49
|
-
callback?: (component: T) => any
|
49
|
+
callback?: (component: T) => any,
|
50
|
+
): T;
|
50
51
|
export function unstable_renderSubtreeIntoContainer<P>(
|
51
52
|
parentComponent: Component<any>,
|
52
53
|
element: ReactElement<P>,
|
53
54
|
container: Element,
|
54
|
-
callback?: (component?: Component<P, ComponentState> | Element) => any
|
55
|
+
callback?: (component?: Component<P, ComponentState> | Element) => any,
|
56
|
+
): Component<P, ComponentState> | Element | void;
|
55
57
|
|
56
58
|
export type Container = Element | Document | DocumentFragment;
|
57
59
|
|
@@ -62,42 +64,42 @@ export interface Renderer {
|
|
62
64
|
<T extends Element>(
|
63
65
|
element: DOMElement<DOMAttributes<T>, T>,
|
64
66
|
container: Container | null,
|
65
|
-
callback?: () => void
|
67
|
+
callback?: () => void,
|
66
68
|
): T;
|
67
69
|
|
68
70
|
(
|
69
71
|
element: Array<DOMElement<DOMAttributes<any>, any>>,
|
70
|
-
container: Container| null,
|
71
|
-
callback?: () => void
|
72
|
+
container: Container | null,
|
73
|
+
callback?: () => void,
|
72
74
|
): Element;
|
73
75
|
|
74
76
|
(
|
75
77
|
element: SFCElement<any> | Array<SFCElement<any>>,
|
76
|
-
container: Container| null,
|
77
|
-
callback?: () => void
|
78
|
+
container: Container | null,
|
79
|
+
callback?: () => void,
|
78
80
|
): void;
|
79
81
|
|
80
82
|
<P, T extends Component<P, ComponentState>>(
|
81
83
|
element: CElement<P, T>,
|
82
|
-
container: Container| null,
|
83
|
-
callback?: () => void
|
84
|
+
container: Container | null,
|
85
|
+
callback?: () => void,
|
84
86
|
): T;
|
85
87
|
|
86
88
|
(
|
87
89
|
element: Array<CElement<any, Component<any, ComponentState>>>,
|
88
|
-
container: Container| null,
|
89
|
-
callback?: () => void
|
90
|
+
container: Container | null,
|
91
|
+
callback?: () => void,
|
90
92
|
): Component<any, ComponentState>;
|
91
93
|
|
92
94
|
<P>(
|
93
95
|
element: ReactElement<P>,
|
94
|
-
container: Container| null,
|
95
|
-
callback?: () => void
|
96
|
+
container: Container | null,
|
97
|
+
callback?: () => void,
|
96
98
|
): Component<P, ComponentState> | Element | void;
|
97
99
|
|
98
100
|
(
|
99
101
|
element: ReactElement[],
|
100
|
-
container: Container| null,
|
101
|
-
callback?: () => void
|
102
|
+
container: Container | null,
|
103
|
+
callback?: () => void,
|
102
104
|
): Component<any, ComponentState> | Element | void;
|
103
105
|
}
|
react-dom v16.9/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react-dom",
|
3
|
-
"version": "16.9.
|
4
|
-
"description": "TypeScript definitions for
|
3
|
+
"version": "16.9.21",
|
4
|
+
"description": "TypeScript definitions for react-dom",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom",
|
6
6
|
"license": "MIT",
|
7
7
|
"contributors": [
|
@@ -19,23 +19,23 @@
|
|
19
19
|
},
|
20
20
|
{
|
21
21
|
"name": "MartynasZilinskas",
|
22
|
-
"
|
23
|
-
"
|
22
|
+
"githubUsername": "MartynasZilinskas",
|
23
|
+
"url": "https://github.com/MartynasZilinskas"
|
24
24
|
},
|
25
25
|
{
|
26
26
|
"name": "Josh Rutherford",
|
27
|
-
"
|
28
|
-
"
|
27
|
+
"githubUsername": "theruther4d",
|
28
|
+
"url": "https://github.com/theruther4d"
|
29
29
|
},
|
30
30
|
{
|
31
31
|
"name": "Jessica Franco",
|
32
|
-
"
|
33
|
-
"
|
32
|
+
"githubUsername": "Jessidhia",
|
33
|
+
"url": "https://github.com/Jessidhia"
|
34
34
|
},
|
35
35
|
{
|
36
36
|
"name": "Sebastian Silbermann",
|
37
|
-
"
|
38
|
-
"
|
37
|
+
"githubUsername": "eps1lon",
|
38
|
+
"url": "https://github.com/eps1lon"
|
39
39
|
}
|
40
40
|
],
|
41
41
|
"main": "",
|
@@ -49,6 +49,6 @@
|
|
49
49
|
"dependencies": {
|
50
50
|
"@types/react": "^16"
|
51
51
|
},
|
52
|
-
"typesPublisherContentHash": "
|
53
|
-
"typeScriptVersion": "4.
|
52
|
+
"typesPublisherContentHash": "4b60f6c96b5a3693ce471f49a098a5e493e3777fb1011bb710bbd0a6795db3ec",
|
53
|
+
"typeScriptVersion": "4.5"
|
54
54
|
}
|
@@ -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
|
+
ReactElement,
|
10
|
+
ReactHTMLElement,
|
11
|
+
ReactInstance,
|
12
|
+
SFC,
|
13
|
+
SFCElement,
|
14
|
+
} from "react";
|
7
15
|
|
8
16
|
import * as ReactTestUtils from ".";
|
9
17
|
|
@@ -23,7 +31,21 @@ export interface OptionalEventProperties {
|
|
23
31
|
type?: string | undefined;
|
24
32
|
}
|
25
33
|
|
26
|
-
export type ModifierKey =
|
34
|
+
export type ModifierKey =
|
35
|
+
| "Alt"
|
36
|
+
| "AltGraph"
|
37
|
+
| "CapsLock"
|
38
|
+
| "Control"
|
39
|
+
| "Fn"
|
40
|
+
| "FnLock"
|
41
|
+
| "Hyper"
|
42
|
+
| "Meta"
|
43
|
+
| "NumLock"
|
44
|
+
| "ScrollLock"
|
45
|
+
| "Shift"
|
46
|
+
| "Super"
|
47
|
+
| "Symbol"
|
48
|
+
| "SymbolLock";
|
27
49
|
|
28
50
|
export interface SyntheticEventData extends OptionalEventProperties {
|
29
51
|
altKey?: boolean | undefined;
|
@@ -62,7 +84,7 @@ export interface SyntheticEventData extends OptionalEventProperties {
|
|
62
84
|
export type EventSimulator = (element: Element | Component<any>, eventData?: SyntheticEventData) => void;
|
63
85
|
|
64
86
|
export interface MockedComponentClass {
|
65
|
-
new
|
87
|
+
new(props: any): any;
|
66
88
|
}
|
67
89
|
|
68
90
|
export interface ShallowRenderer {
|
@@ -81,7 +103,7 @@ export interface ShallowRenderer {
|
|
81
103
|
* Simulate an event dispatch on a DOM node with optional `eventData` event data.
|
82
104
|
* `Simulate` has a method for every event that React understands.
|
83
105
|
*/
|
84
|
-
|
106
|
+
export namespace Simulate {
|
85
107
|
const abort: EventSimulator;
|
86
108
|
const animationEnd: EventSimulator;
|
87
109
|
const animationIteration: EventSimulator;
|
@@ -172,17 +194,21 @@ export interface ShallowRenderer {
|
|
172
194
|
* Render a React element into a detached DOM node in the document. __This function requires a DOM__.
|
173
195
|
*/
|
174
196
|
export function renderIntoDocument<T extends Element>(
|
175
|
-
element: DOMElement<any, T
|
197
|
+
element: DOMElement<any, T>,
|
198
|
+
): T;
|
176
199
|
export function renderIntoDocument(
|
177
|
-
element: SFCElement<any
|
200
|
+
element: SFCElement<any>,
|
201
|
+
): void;
|
178
202
|
// If we replace `P` with `any` in this overload, then some tests fail because
|
179
203
|
// calls to `renderIntoDocument` choose the last overload on the
|
180
204
|
// subtype-relation pass and get an undesirably broad return type. Using `P`
|
181
205
|
// allows this overload to match on the subtype-relation pass.
|
182
206
|
export function renderIntoDocument<P, T extends Component<P>>(
|
183
|
-
element: CElement<P, T
|
207
|
+
element: CElement<P, T>,
|
208
|
+
): T;
|
184
209
|
export function renderIntoDocument<P>(
|
185
|
-
element: ReactElement<P
|
210
|
+
element: ReactElement<P>,
|
211
|
+
): Component<P> | Element | void;
|
186
212
|
|
187
213
|
/**
|
188
214
|
* Pass a mocked component module to this method to augment it with useful methods that allow it to
|
@@ -190,7 +216,9 @@ export function renderIntoDocument<P>(
|
|
190
216
|
* a simple `<div>` (or other tag if `mockTagName` is provided) containing any provided children.
|
191
217
|
*/
|
192
218
|
export function mockComponent(
|
193
|
-
mocked: MockedComponentClass,
|
219
|
+
mocked: MockedComponentClass,
|
220
|
+
mockTagName?: string,
|
221
|
+
): typeof ReactTestUtils;
|
194
222
|
|
195
223
|
/**
|
196
224
|
* Returns `true` if `element` is any React element.
|
@@ -201,22 +229,30 @@ export function isElement(element: any): boolean;
|
|
201
229
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
202
230
|
*/
|
203
231
|
export function isElementOfType<T extends HTMLElement>(
|
204
|
-
element: ReactElement,
|
232
|
+
element: ReactElement,
|
233
|
+
type: string,
|
234
|
+
): element is ReactHTMLElement<T>;
|
205
235
|
/**
|
206
236
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
207
237
|
*/
|
208
238
|
export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>(
|
209
|
-
element: ReactElement,
|
239
|
+
element: ReactElement,
|
240
|
+
type: string,
|
241
|
+
): element is DOMElement<P, T>;
|
210
242
|
/**
|
211
243
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
212
244
|
*/
|
213
245
|
export function isElementOfType<P>(
|
214
|
-
element: ReactElement,
|
246
|
+
element: ReactElement,
|
247
|
+
type: SFC<P>,
|
248
|
+
): element is SFCElement<P>;
|
215
249
|
/**
|
216
250
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
217
251
|
*/
|
218
252
|
export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>(
|
219
|
-
element: ReactElement,
|
253
|
+
element: ReactElement,
|
254
|
+
type: ClassType<P, T, C>,
|
255
|
+
): element is CElement<P, T>;
|
220
256
|
|
221
257
|
/**
|
222
258
|
* Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
|
@@ -230,7 +266,9 @@ export function isCompositeComponent(instance: ReactInstance): instance is Compo
|
|
230
266
|
* Returns `true` if `instance` is a component whose type is of a React `componentClass`.
|
231
267
|
*/
|
232
268
|
export function isCompositeComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
|
233
|
-
instance: ReactInstance,
|
269
|
+
instance: ReactInstance,
|
270
|
+
type: ClassType<any, T, C>,
|
271
|
+
): boolean;
|
234
272
|
|
235
273
|
/**
|
236
274
|
* Traverse all components in `tree` and accumulate all components where
|
@@ -239,7 +277,8 @@ export function isCompositeComponentWithType<T extends Component<any>, C extends
|
|
239
277
|
*/
|
240
278
|
export function findAllInRenderedTree(
|
241
279
|
root: Component<any>,
|
242
|
-
fn: (i: ReactInstance) => boolean
|
280
|
+
fn: (i: ReactInstance) => boolean,
|
281
|
+
): ReactInstance[];
|
243
282
|
|
244
283
|
/**
|
245
284
|
* Finds all DOM elements of components in the rendered tree that are
|
@@ -247,7 +286,8 @@ export function findAllInRenderedTree(
|
|
247
286
|
*/
|
248
287
|
export function scryRenderedDOMComponentsWithClass(
|
249
288
|
root: Component<any>,
|
250
|
-
className: string
|
289
|
+
className: string,
|
290
|
+
): Element[];
|
251
291
|
/**
|
252
292
|
* Like `scryRenderedDOMComponentsWithClass()` but expects there to be one result,
|
253
293
|
* and returns that one result, or throws exception if there is any other
|
@@ -255,7 +295,8 @@ export function scryRenderedDOMComponentsWithClass(
|
|
255
295
|
*/
|
256
296
|
export function findRenderedDOMComponentWithClass(
|
257
297
|
root: Component<any>,
|
258
|
-
className: string
|
298
|
+
className: string,
|
299
|
+
): Element;
|
259
300
|
|
260
301
|
/**
|
261
302
|
* Finds all DOM elements of components in the rendered tree that are
|
@@ -263,7 +304,8 @@ export function findRenderedDOMComponentWithClass(
|
|
263
304
|
*/
|
264
305
|
export function scryRenderedDOMComponentsWithTag(
|
265
306
|
root: Component<any>,
|
266
|
-
tagName: string
|
307
|
+
tagName: string,
|
308
|
+
): Element[];
|
267
309
|
/**
|
268
310
|
* Like `scryRenderedDOMComponentsWithTag()` but expects there to be one result,
|
269
311
|
* and returns that one result, or throws exception if there is any other
|
@@ -271,14 +313,16 @@ export function scryRenderedDOMComponentsWithTag(
|
|
271
313
|
*/
|
272
314
|
export function findRenderedDOMComponentWithTag(
|
273
315
|
root: Component<any>,
|
274
|
-
tagName: string
|
316
|
+
tagName: string,
|
317
|
+
): Element;
|
275
318
|
|
276
319
|
/**
|
277
320
|
* Finds all instances of components with type equal to `componentClass`.
|
278
321
|
*/
|
279
322
|
export function scryRenderedComponentsWithType<T extends Component<any>, C extends ComponentClass<any>>(
|
280
323
|
root: Component<any>,
|
281
|
-
type: ClassType<any, T, C
|
324
|
+
type: ClassType<any, T, C>,
|
325
|
+
): T[];
|
282
326
|
|
283
327
|
/**
|
284
328
|
* Same as `scryRenderedComponentsWithType()` but expects there to be one result
|
@@ -287,7 +331,8 @@ export function scryRenderedComponentsWithType<T extends Component<any>, C exten
|
|
287
331
|
*/
|
288
332
|
export function findRenderedComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
|
289
333
|
root: Component<any>,
|
290
|
-
type: ClassType<any, T, C
|
334
|
+
type: ClassType<any, T, C>,
|
335
|
+
): T;
|
291
336
|
|
292
337
|
/**
|
293
338
|
* Call this in your tests to create a shallow renderer.
|