@types/react-dom 16.0.11 → 16.8.3

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 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: Tue, 27 Nov 2018 22:06:51 GMT
12
- * Dependencies: react
11
+ * Last updated: Wed, 20 Mar 2019 20:05:19 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.0
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: Array<ReactElement<any>>,
90
+ element: ReactElement[],
90
91
  container: Element | null,
91
92
  callback?: () => void
92
93
  ): Component<any, ComponentState> | Element | void;
@@ -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<any>): any;
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<any>): any;
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.0.11",
3
+ "version": "16.8.3",
4
4
  "description": "TypeScript definitions for React (react-dom)",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -25,18 +25,24 @@
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": "",
31
36
  "types": "index",
32
37
  "repository": {
33
38
  "type": "git",
34
- "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git"
39
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
40
+ "directory": "types/react-dom"
35
41
  },
36
42
  "scripts": {},
37
43
  "dependencies": {
38
44
  "@types/react": "*"
39
45
  },
40
- "typesPublisherContentHash": "de1f8ab5d92919c9885d08a2fb6995965e0ef7945f4de92cab32b6621130dc21",
46
+ "typesPublisherContentHash": "21c4a9a0147ce5b409a68a6c988f0b8e3e9b11debb97945f3ee0c63aaaadffaa",
41
47
  "typeScriptVersion": "2.8"
42
48
  }
@@ -18,14 +18,14 @@ import { ReactElement } from 'react';
18
18
  * React will preserve it and only attach event handlers, allowing you
19
19
  * to have a very performant first-load experience.
20
20
  */
21
- export function renderToString(element: ReactElement<any>): string;
21
+ export function renderToString(element: ReactElement): string;
22
22
 
23
23
  /**
24
24
  * Render a React element to its initial HTML. Returns a Readable stream that outputs
25
25
  * an HTML string. The HTML output by this stream is exactly equal to what
26
26
  * `ReactDOMServer.renderToString()` would return.
27
27
  */
28
- export function renderToNodeStream(element: ReactElement<any>): NodeJS.ReadableStream;
28
+ export function renderToNodeStream(element: ReactElement): NodeJS.ReadableStream;
29
29
 
30
30
  /**
31
31
  * Similar to `renderToString`, except this doesn't create extra DOM attributes
@@ -33,14 +33,14 @@ export function renderToNodeStream(element: ReactElement<any>): NodeJS.ReadableS
33
33
  * to use React as a simple static page generator, as stripping away the extra
34
34
  * attributes can save lots of bytes.
35
35
  */
36
- export function renderToStaticMarkup(element: ReactElement<any>): string;
36
+ export function renderToStaticMarkup(element: ReactElement): string;
37
37
 
38
38
  /**
39
39
  * Similar to `renderToNodeStream`, except this doesn't create extra DOM attributes
40
40
  * such as `data-reactid`, that React uses internally. The HTML output by this stream
41
41
  * is exactly equal to what `ReactDOMServer.renderToStaticMarkup()` would return.
42
42
  */
43
- export function renderToStaticNodeStream(element: ReactElement<any>): NodeJS.ReadableStream;
43
+ export function renderToStaticNodeStream(element: ReactElement): NodeJS.ReadableStream;
44
44
 
45
45
  export const version: string;
46
46
 
@@ -29,7 +29,7 @@ export interface SyntheticEventData extends OptionalEventProperties {
29
29
  clientX?: number;
30
30
  clientY?: number;
31
31
  changedTouches?: TouchList;
32
- charCode?: boolean;
32
+ charCode?: number;
33
33
  clipboardData?: DataTransfer;
34
34
  ctrlKey?: boolean;
35
35
  deltaMode?: number;
@@ -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<any>>(): E;
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<any>;
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<any>, context?: any): void;
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<any>, type: string): element is ReactHTMLElement<T>;
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<any>, type: string): element is DOMElement<P, T>;
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<any>, type: SFC<P>): element is SFCElement<P>;
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<any>, type: ClassType<P, T, C>): element is CElement<P, T>;
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
+ }