@types/react-dom 16.0.9 → 16.8.1
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 +21 -21
- react-dom/README.md +4 -4
- react-dom/index.d.ts +3 -2
- react-dom/node-stream/index.d.ts +2 -2
- react-dom/package.json +9 -4
- react-dom/server/index.d.ts +11 -5
- react-dom/test-utils/index.d.ts +39 -12
react-dom/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE
|
react-dom/README.md
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
> `npm install --save @types/react-dom`
|
3
3
|
|
4
4
|
# Summary
|
5
|
-
This package contains type definitions for React (react-dom) (http://facebook.github.io/react/).
|
5
|
+
This package contains type definitions for React (react-dom) ( http://facebook.github.io/react/ ).
|
6
6
|
|
7
7
|
# Details
|
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:
|
12
|
-
* Dependencies: react
|
11
|
+
* Last updated: Wed, 13 Feb 2019 21:04:55 GMT
|
12
|
+
* Dependencies: @types/react
|
13
13
|
* Global values: ReactDOM, ReactDOMNodeStream, ReactDOMServer
|
14
14
|
|
15
15
|
# Credits
|
16
|
-
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>.
|
16
|
+
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>.
|
react-dom/index.d.ts
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
// Type definitions for React (react-dom) 16.
|
1
|
+
// Type definitions for React (react-dom) 16.8
|
2
2
|
// Project: http://facebook.github.io/react/
|
3
3
|
// Definitions by: Asana <https://asana.com>
|
4
4
|
// AssureSign <http://www.assuresign.com>
|
5
5
|
// Microsoft <https://microsoft.com>
|
6
6
|
// MartynasZilinskas <https://github.com/MartynasZilinskas>
|
7
7
|
// Josh Rutherford <https://github.com/theruther4d>
|
8
|
+
// Jessica Franco <https://github.com/Jessidhia>
|
8
9
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
9
10
|
// TypeScript Version: 2.8
|
10
11
|
|
@@ -86,7 +87,7 @@ export interface Renderer {
|
|
86
87
|
): Component<P, ComponentState> | Element | void;
|
87
88
|
|
88
89
|
(
|
89
|
-
element:
|
90
|
+
element: ReactElement[],
|
90
91
|
container: Element | null,
|
91
92
|
callback?: () => void
|
92
93
|
): Component<any, ComponentState> | Element | void;
|
react-dom/node-stream/index.d.ts
CHANGED
@@ -5,14 +5,14 @@ import { ReactElement } from 'react';
|
|
5
5
|
* server.
|
6
6
|
* See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostream
|
7
7
|
*/
|
8
|
-
export function renderToStream(element: ReactElement
|
8
|
+
export function renderToStream(element: ReactElement): any;
|
9
9
|
|
10
10
|
/**
|
11
11
|
* Similar to renderToStream, except this doesn't create extra DOM attributes
|
12
12
|
* such as data-react-id that React uses internally.
|
13
13
|
* See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostaticstream
|
14
14
|
*/
|
15
|
-
export function renderToStaticStream(element: ReactElement
|
15
|
+
export function renderToStaticStream(element: ReactElement): any;
|
16
16
|
export const version: string;
|
17
17
|
|
18
18
|
export as namespace ReactDOMNodeStream;
|
react-dom/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react-dom",
|
3
|
-
"version": "16.
|
3
|
+
"version": "16.8.1",
|
4
4
|
"description": "TypeScript definitions for React (react-dom)",
|
5
5
|
"license": "MIT",
|
6
6
|
"contributors": [
|
@@ -25,18 +25,23 @@
|
|
25
25
|
"name": "Josh Rutherford",
|
26
26
|
"url": "https://github.com/theruther4d",
|
27
27
|
"githubUsername": "theruther4d"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"name": "Jessica Franco",
|
31
|
+
"url": "https://github.com/Jessidhia",
|
32
|
+
"githubUsername": "Jessidhia"
|
28
33
|
}
|
29
34
|
],
|
30
35
|
"main": "",
|
36
|
+
"types": "index",
|
31
37
|
"repository": {
|
32
38
|
"type": "git",
|
33
39
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git"
|
34
40
|
},
|
35
41
|
"scripts": {},
|
36
42
|
"dependencies": {
|
37
|
-
"@types/react": "*"
|
38
|
-
"@types/node": "*"
|
43
|
+
"@types/react": "*"
|
39
44
|
},
|
40
|
-
"typesPublisherContentHash": "
|
45
|
+
"typesPublisherContentHash": "d61e9c5f7701893629315e54225f99c546539702788d18b5140f6c3d34973a72",
|
41
46
|
"typeScriptVersion": "2.8"
|
42
47
|
}
|
react-dom/server/index.d.ts
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
|
1
|
+
// forward declarations
|
2
|
+
declare global {
|
3
|
+
namespace NodeJS {
|
4
|
+
// tslint:disable-next-line:no-empty-interface
|
5
|
+
interface ReadableStream {}
|
6
|
+
}
|
7
|
+
}
|
2
8
|
|
3
9
|
import { ReactElement } from 'react';
|
4
10
|
|
@@ -12,14 +18,14 @@ import { ReactElement } from 'react';
|
|
12
18
|
* React will preserve it and only attach event handlers, allowing you
|
13
19
|
* to have a very performant first-load experience.
|
14
20
|
*/
|
15
|
-
export function renderToString(element: ReactElement
|
21
|
+
export function renderToString(element: ReactElement): string;
|
16
22
|
|
17
23
|
/**
|
18
24
|
* Render a React element to its initial HTML. Returns a Readable stream that outputs
|
19
25
|
* an HTML string. The HTML output by this stream is exactly equal to what
|
20
26
|
* `ReactDOMServer.renderToString()` would return.
|
21
27
|
*/
|
22
|
-
export function renderToNodeStream(element: ReactElement
|
28
|
+
export function renderToNodeStream(element: ReactElement): NodeJS.ReadableStream;
|
23
29
|
|
24
30
|
/**
|
25
31
|
* Similar to `renderToString`, except this doesn't create extra DOM attributes
|
@@ -27,14 +33,14 @@ export function renderToNodeStream(element: ReactElement<any>): NodeJS.ReadableS
|
|
27
33
|
* to use React as a simple static page generator, as stripping away the extra
|
28
34
|
* attributes can save lots of bytes.
|
29
35
|
*/
|
30
|
-
export function renderToStaticMarkup(element: ReactElement
|
36
|
+
export function renderToStaticMarkup(element: ReactElement): string;
|
31
37
|
|
32
38
|
/**
|
33
39
|
* Similar to `renderToNodeStream`, except this doesn't create extra DOM attributes
|
34
40
|
* such as `data-reactid`, that React uses internally. The HTML output by this stream
|
35
41
|
* is exactly equal to what `ReactDOMServer.renderToStaticMarkup()` would return.
|
36
42
|
*/
|
37
|
-
export function renderToStaticNodeStream(element: ReactElement
|
43
|
+
export function renderToStaticNodeStream(element: ReactElement): NodeJS.ReadableStream;
|
38
44
|
|
39
45
|
export const version: string;
|
40
46
|
|
react-dom/test-utils/index.d.ts
CHANGED
@@ -59,22 +59,22 @@ export interface SyntheticEventData extends OptionalEventProperties {
|
|
59
59
|
export type EventSimulator = (element: Element | Component<any>, eventData?: SyntheticEventData) => void;
|
60
60
|
|
61
61
|
export interface MockedComponentClass {
|
62
|
-
new (props:
|
62
|
+
new (props: any): any;
|
63
63
|
}
|
64
64
|
|
65
65
|
export interface ShallowRenderer {
|
66
66
|
/**
|
67
67
|
* After `shallowRenderer.render()` has been called, returns shallowly rendered output.
|
68
68
|
*/
|
69
|
-
getRenderOutput<E extends ReactElement
|
69
|
+
getRenderOutput<E extends ReactElement>(): E;
|
70
70
|
/**
|
71
71
|
* After `shallowRenderer.render()` has been called, returns shallowly rendered output.
|
72
72
|
*/
|
73
|
-
getRenderOutput(): ReactElement
|
73
|
+
getRenderOutput(): ReactElement;
|
74
74
|
/**
|
75
75
|
* Similar to `ReactDOM.render` but it doesn't require DOM and only renders a single level deep.
|
76
76
|
*/
|
77
|
-
render(element: ReactElement
|
77
|
+
render(element: ReactElement, context?: any): void;
|
78
78
|
unmount(): void;
|
79
79
|
}
|
80
80
|
|
@@ -160,8 +160,12 @@ export function renderIntoDocument<T extends Element>(
|
|
160
160
|
element: DOMElement<any, T>): T;
|
161
161
|
export function renderIntoDocument(
|
162
162
|
element: SFCElement<any>): void;
|
163
|
-
|
164
|
-
|
163
|
+
// If we replace `P` with `any` in this overload, then some tests fail because
|
164
|
+
// calls to `renderIntoDocument` choose the last overload on the
|
165
|
+
// subtype-relation pass and get an undesirably broad return type. Using `P`
|
166
|
+
// allows this overload to match on the subtype-relation pass.
|
167
|
+
export function renderIntoDocument<P, T extends Component<P>>(
|
168
|
+
element: CElement<P, T>): T;
|
165
169
|
export function renderIntoDocument<P>(
|
166
170
|
element: ReactElement<P>): Component<P> | Element | void;
|
167
171
|
|
@@ -182,22 +186,22 @@ export function isElement(element: any): boolean;
|
|
182
186
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
183
187
|
*/
|
184
188
|
export function isElementOfType<T extends HTMLElement>(
|
185
|
-
element: ReactElement
|
189
|
+
element: ReactElement, type: string): element is ReactHTMLElement<T>;
|
186
190
|
/**
|
187
191
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
188
192
|
*/
|
189
193
|
export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>(
|
190
|
-
element: ReactElement
|
194
|
+
element: ReactElement, type: string): element is DOMElement<P, T>;
|
191
195
|
/**
|
192
196
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
193
197
|
*/
|
194
198
|
export function isElementOfType<P>(
|
195
|
-
element: ReactElement
|
199
|
+
element: ReactElement, type: SFC<P>): element is SFCElement<P>;
|
196
200
|
/**
|
197
201
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
198
202
|
*/
|
199
203
|
export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>(
|
200
|
-
element: ReactElement
|
204
|
+
element: ReactElement, type: ClassType<P, T, C>): element is CElement<P, T>;
|
201
205
|
|
202
206
|
/**
|
203
207
|
* Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
|
@@ -257,7 +261,7 @@ export function findRenderedDOMComponentWithTag(
|
|
257
261
|
/**
|
258
262
|
* Finds all instances of components with type equal to `componentClass`.
|
259
263
|
*/
|
260
|
-
export function scryRenderedComponentsWithType<T extends Component
|
264
|
+
export function scryRenderedComponentsWithType<T extends Component<any>, C extends ComponentClass<any>>(
|
261
265
|
root: Component<any>,
|
262
266
|
type: ClassType<any, T, C>): T[];
|
263
267
|
|
@@ -266,7 +270,7 @@ export function scryRenderedComponentsWithType<T extends Component, C extends Co
|
|
266
270
|
* and returns that one result, or throws exception if there is any other
|
267
271
|
* number of matches besides one.
|
268
272
|
*/
|
269
|
-
export function findRenderedComponentWithType<T extends Component
|
273
|
+
export function findRenderedComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
|
270
274
|
root: Component<any>,
|
271
275
|
type: ClassType<any, T, C>): T;
|
272
276
|
|
@@ -274,3 +278,26 @@ export function findRenderedComponentWithType<T extends Component, C extends Com
|
|
274
278
|
* Call this in your tests to create a shallow renderer.
|
275
279
|
*/
|
276
280
|
export function createRenderer(): ShallowRenderer;
|
281
|
+
|
282
|
+
/**
|
283
|
+
* Wrap any code rendering and triggering updates to your components into `act()` calls.
|
284
|
+
*
|
285
|
+
* Ensures that the behavior in your tests matches what happens in the browser
|
286
|
+
* more closely by executing pending `useEffect`s before returning. This also
|
287
|
+
* reduces the amount of re-renders done.
|
288
|
+
*
|
289
|
+
* @param callback A synchronous, void callback that will execute as a single, complete React commit.
|
290
|
+
*
|
291
|
+
* @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
|
292
|
+
*/
|
293
|
+
// the "void | undefined" is here to forbid any sneaky "Promise" returns.
|
294
|
+
// the actual return value is always a "DebugPromiseLike",
|
295
|
+
// but having an "| {}" makes it harder to accidentally use.
|
296
|
+
export function act(callback: () => void | undefined): DebugPromiseLike | {};
|
297
|
+
|
298
|
+
// Intentionally doesn't extend PromiseLike<never>.
|
299
|
+
// Ideally this should be as hard to accidentally use as possible.
|
300
|
+
export interface DebugPromiseLike {
|
301
|
+
// the actual then() in here is 0-ary, but that doesn't count as a PromiseLike.
|
302
|
+
then(onfulfilled: (value: never) => never, onrejected: (reason: never) => never): never;
|
303
|
+
}
|