@types/react-dom 17.0.14 → 18.0.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/README.md CHANGED
@@ -8,9 +8,9 @@ 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: Sat, 19 Mar 2022 07:31:42 GMT
11
+ * Last updated: Thu, 14 Apr 2022 21:31:22 GMT
12
12
  * Dependencies: [@types/react](https://npmjs.com/package/@types/react)
13
- * Global values: `ReactDOM`, `ReactDOMNodeStream`, `ReactDOMServer`
13
+ * Global values: `ReactDOM`, `ReactDOMServer`
14
14
 
15
15
  # Credits
16
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), and [Sebastian Silbermann](https://github.com/eps1lon).
@@ -24,22 +24,12 @@
24
24
  * Either the import or the reference only needs to appear once, anywhere in the project.
25
25
  */
26
26
 
27
- // See https://github.com/facebook/react/blob/master/packages/react-dom/src/client/ReactDOM.js to see how the exports are declared,
28
- // and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are
29
- // flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`.
27
+ // See https://github.com/facebook/react/blob/main/packages/react-dom/index.experimental.js to see how the exports are declared,
28
+ // but confirm with published source code (e.g. https://unpkg.com/react-dom@experimental) that these exports end up in the published code
30
29
 
31
30
  import React = require('react');
32
31
  import ReactDOM = require('./next');
33
32
 
34
33
  export {};
35
34
 
36
- declare module '.' {
37
- function unstable_flushControlled(callback: () => void): void;
38
-
39
- // enableSelectiveHydration feature
40
-
41
- /**
42
- * @see https://github.com/facebook/react/commit/3a2b5f148d450c69aab67f055fc441d294c23518
43
- */
44
- function unstable_scheduleHydration(target: Element | Document | DocumentFragment | Comment): void;
45
- }
35
+ declare module '.' {}
react-dom/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for React (react-dom) 17.0
1
+ // Type definitions for React (react-dom) 18.0
2
2
  // Project: https://reactjs.org
3
3
  // Definitions by: Asana <https://asana.com>
4
4
  // AssureSign <http://www.assuresign.com>
@@ -10,10 +10,6 @@
10
10
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
11
11
  // TypeScript Version: 2.8
12
12
 
13
- // NOTE: Users of the upcoming React 18 release should add a reference
14
- // to 'react-dom/next' in their project. See next.d.ts's top comment
15
- // for reference and documentation on how exactly to do it.
16
-
17
13
  // NOTE: Users of the `experimental` builds of React should add a reference
18
14
  // to 'react-dom/experimental' in their project. See experimental.d.ts's top comment
19
15
  // for reference and documentation on how exactly to do it.
react-dom/next.d.ts CHANGED
@@ -23,7 +23,8 @@
23
23
  * Either the import or the reference only needs to appear once, anywhere in the project.
24
24
  */
25
25
 
26
- // See https://github.com/facebook/react/blob/master/packages/react-dom/src/client/ReactDOM.js to see how the exports are declared,
26
+ // See https://github.com/facebook/react/blob/main/packages/react-dom/index.js to see how the exports are declared,
27
+ // but confirm with published source code (e.g. https://unpkg.com/react-dom@next) that these exports end up in the published code
27
28
 
28
29
  import React = require('react');
29
30
  import ReactDOM = require('.');
react-dom/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react-dom",
3
- "version": "17.0.14",
3
+ "version": "18.0.1",
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,6 +49,6 @@
49
49
  "dependencies": {
50
50
  "@types/react": "*"
51
51
  },
52
- "typesPublisherContentHash": "bb6ccdfb4be52f5b94a8ea67684c63c29d57b4ff383a3f33fd7e1a81e35f264f",
52
+ "typesPublisherContentHash": "c62090e5d492de8a9ddd5cc8119bb97f1fe2c2b957eae3db84e851e68c162be1",
53
53
  "typeScriptVersion": "3.9"
54
54
  }
react-dom/server.d.ts CHANGED
@@ -3,10 +3,54 @@ declare global {
3
3
  namespace NodeJS {
4
4
  // tslint:disable-next-line:no-empty-interface
5
5
  interface ReadableStream {}
6
+
7
+ // tslint:disable-next-line:no-empty-interface
8
+ interface WritableStream {}
6
9
  }
10
+
11
+ /**
12
+ * Stub for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
13
+ */
14
+ // tslint:disable-next-line:no-empty-interface
15
+ interface AbortSignal {}
16
+
17
+ /**
18
+ * Stub for https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
19
+ */
20
+ // tslint:disable-next-line:no-empty-interface
21
+ interface ReadableStream {}
7
22
  }
8
23
 
9
- import { ReactElement } from 'react';
24
+ import { ReactElement, ReactNode } from 'react';
25
+
26
+ export interface RenderToPipeableStreamOptions {
27
+ identifierPrefix?: string;
28
+ namespaceURI?: string;
29
+ nonce?: string;
30
+ bootstrapScriptContent?: string;
31
+ bootstrapScripts?: string[];
32
+ bootstrapModules?: string[];
33
+ progressiveChunkSize?: number;
34
+ onShellReady?: () => void;
35
+ onShellError?: (error: unknown) => void;
36
+ onAllReady?: () => void;
37
+ onError?: (error: unknown) => void;
38
+ }
39
+
40
+ export interface PipeableStream {
41
+ abort(): void;
42
+ pipe<Writable extends NodeJS.WritableStream>(destination: Writable): Writable;
43
+ }
44
+
45
+ /**
46
+ * Only available in the environments with [Node.js Streams](https://nodejs.dev/learn/nodejs-streams).
47
+ *
48
+ * @see [API](https://reactjs.org/docs/react-dom-server.html#rendertopipeablestream)
49
+ *
50
+ * @param children
51
+ * @param options
52
+ */
53
+ export function renderToPipeableStream(children: ReactNode, options?: RenderToPipeableStreamOptions): PipeableStream;
10
54
 
11
55
  /**
12
56
  * Render a React element to its initial HTML. This should only be used on the server.
@@ -24,6 +68,8 @@ export function renderToString(element: ReactElement): string;
24
68
  * Render a React element to its initial HTML. Returns a Readable stream that outputs
25
69
  * an HTML string. The HTML output by this stream is exactly equal to what
26
70
  * `ReactDOMServer.renderToString()` would return.
71
+ *
72
+ * @deprecated
27
73
  */
28
74
  export function renderToNodeStream(element: ReactElement): NodeJS.ReadableStream;
29
75
 
@@ -42,6 +88,32 @@ export function renderToStaticMarkup(element: ReactElement): string;
42
88
  */
43
89
  export function renderToStaticNodeStream(element: ReactElement): NodeJS.ReadableStream;
44
90
 
91
+ export interface RenderToReadableStreamOptions {
92
+ identifierPrefix?: string;
93
+ namespaceURI?: string;
94
+ nonce?: string;
95
+ bootstrapScriptContent?: string;
96
+ bootstrapScripts?: string[];
97
+ bootstrapModules?: string[];
98
+ progressiveChunkSize?: number;
99
+ signal?: AbortSignal;
100
+ onError?: (error: unknown) => void;
101
+ }
102
+
103
+ export interface ReactDOMServerReadableStream extends ReadableStream {
104
+ allReady: Promise<void>;
105
+ }
106
+
107
+ /**
108
+ * Only available in the environments with [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) (this includes browsers, Deno, and some modern edge runtimes).
109
+ *
110
+ * @see [API](https://reactjs.org/docs/react-dom-server.html#rendertoreadablestream)
111
+ */
112
+ export function renderToReadableStream(
113
+ children: ReactNode,
114
+ options?: RenderToReadableStreamOptions,
115
+ ): Promise<ReactDOMServerReadableStream>;
116
+
45
117
  export const version: string;
46
118
 
47
119
  export as namespace ReactDOMServer;
@@ -2,7 +2,7 @@ import {
2
2
  AbstractView, Component, ComponentClass,
3
3
  ReactElement, ReactInstance, ClassType,
4
4
  DOMElement, FunctionComponentElement, CElement,
5
- ReactHTMLElement, DOMAttributes, SFC
5
+ ReactHTMLElement, DOMAttributes, FC
6
6
  } from 'react';
7
7
 
8
8
  import * as ReactTestUtils from ".";
@@ -194,7 +194,7 @@ export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>(
194
194
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
195
195
  */
196
196
  export function isElementOfType<P>(
197
- element: ReactElement, type: SFC<P>): element is FunctionComponentElement<P>;
197
+ element: ReactElement, type: FC<P>): element is FunctionComponentElement<P>;
198
198
  /**
199
199
  * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
200
200
  */
@@ -1,18 +0,0 @@
1
- import { ReactElement } from 'react';
2
-
3
- /**
4
- * Render a ReactElement to its initial HTML. This should only be used on the
5
- * server.
6
- * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostream
7
- */
8
- export function renderToStream(element: ReactElement): any;
9
-
10
- /**
11
- * Similar to renderToStream, except this doesn't create extra DOM attributes
12
- * such as data-react-id that React uses internally.
13
- * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostaticstream
14
- */
15
- export function renderToStaticStream(element: ReactElement): any;
16
- export const version: string;
17
-
18
- export as namespace ReactDOMNodeStream;