@types/react-dom 16.0.10 → 16.8.2
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/README.md +4 -4
- react-dom/index.d.ts +4 -3
- react-dom/node-stream/index.d.ts +2 -2
- react-dom/package.json +8 -4
- react-dom/server/index.d.ts +11 -5
- react-dom/test-utils/index.d.ts +30 -7
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: Sat, 16 Feb 2019 17:42:08 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
|
|
@@ -16,7 +17,7 @@ import {
|
|
16
17
|
DOMAttributes, DOMElement, ReactNode, ReactPortal
|
17
18
|
} from 'react';
|
18
19
|
|
19
|
-
export function findDOMNode(instance: ReactInstance): Element | null | Text;
|
20
|
+
export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text;
|
20
21
|
export function unmountComponentAtNode(container: Element): boolean;
|
21
22
|
|
22
23
|
export function createPortal(children: ReactNode, container: Element, key?: null | string): ReactPortal;
|
@@ -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.2",
|
4
4
|
"description": "TypeScript definitions for React (react-dom)",
|
5
5
|
"license": "MIT",
|
6
6
|
"contributors": [
|
@@ -25,6 +25,11 @@
|
|
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": "",
|
@@ -35,9 +40,8 @@
|
|
35
40
|
},
|
36
41
|
"scripts": {},
|
37
42
|
"dependencies": {
|
38
|
-
"@types/react": "*"
|
39
|
-
"@types/node": "*"
|
43
|
+
"@types/react": "*"
|
40
44
|
},
|
41
|
-
"typesPublisherContentHash": "
|
45
|
+
"typesPublisherContentHash": "efeed5f88d721ec3aa58ef3d2b2defaed4abbeedf94c989085f5b597a3f0383c",
|
42
46
|
"typeScriptVersion": "2.8"
|
43
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
@@ -66,15 +66,15 @@ 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
|
|
@@ -186,22 +186,22 @@ export function isElement(element: any): boolean;
|
|
186
186
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
187
187
|
*/
|
188
188
|
export function isElementOfType<T extends HTMLElement>(
|
189
|
-
element: ReactElement
|
189
|
+
element: ReactElement, type: string): element is ReactHTMLElement<T>;
|
190
190
|
/**
|
191
191
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
192
192
|
*/
|
193
193
|
export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>(
|
194
|
-
element: ReactElement
|
194
|
+
element: ReactElement, type: string): element is DOMElement<P, T>;
|
195
195
|
/**
|
196
196
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
197
197
|
*/
|
198
198
|
export function isElementOfType<P>(
|
199
|
-
element: ReactElement
|
199
|
+
element: ReactElement, type: SFC<P>): element is SFCElement<P>;
|
200
200
|
/**
|
201
201
|
* Returns `true` if `element` is a React element whose type is of a React `componentClass`.
|
202
202
|
*/
|
203
203
|
export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>(
|
204
|
-
element: ReactElement
|
204
|
+
element: ReactElement, type: ClassType<P, T, C>): element is CElement<P, T>;
|
205
205
|
|
206
206
|
/**
|
207
207
|
* Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
|
@@ -278,3 +278,26 @@ export function findRenderedComponentWithType<T extends Component<any>, C extend
|
|
278
278
|
* Call this in your tests to create a shallow renderer.
|
279
279
|
*/
|
280
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
|
+
}
|