@types/react-dom 18.0.0 → 18.0.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
@@ -8,7 +8,7 @@ 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: Thu, 07 Apr 2022 17:31:23 GMT
11
+ * Last updated: Thu, 28 Apr 2022 23:31:45 GMT
12
12
  * Dependencies: [@types/react](https://npmjs.com/package/@types/react)
13
13
  * Global values: `ReactDOM`, `ReactDOMServer`
14
14
 
react-dom/client.d.ts CHANGED
@@ -22,7 +22,7 @@ export interface RootOptions {
22
22
  }
23
23
 
24
24
  export interface Root {
25
- render(children: React.ReactChild | Iterable<React.ReactNode>): void;
25
+ render(children: React.ReactNode): void;
26
26
  unmount(): void;
27
27
  }
28
28
 
@@ -35,6 +35,6 @@ export function createRoot(container: Element | DocumentFragment, options?: Root
35
35
 
36
36
  export function hydrateRoot(
37
37
  container: Element | Document,
38
- initialChildren: React.ReactChild | Iterable<React.ReactNode>,
38
+ initialChildren: React.ReactNode,
39
39
  options?: HydrationOptions,
40
40
  ): Root;
@@ -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/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": "18.0.0",
3
+ "version": "18.0.3",
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,34 @@
49
49
  "dependencies": {
50
50
  "@types/react": "*"
51
51
  },
52
- "typesPublisherContentHash": "9cea04e66af8b05388781f9a22be0a7fda3c5d386d03fe4bdde26a442e6e4672",
53
- "typeScriptVersion": "3.9"
52
+ "typesPublisherContentHash": "beabea1eec76768b42649fc9a768b90963113ad6306de533c8c68326ce67e0e6",
53
+ "typeScriptVersion": "3.9",
54
+ "exports": {
55
+ ".": {
56
+ "types": {
57
+ "default": "./index.d.ts"
58
+ }
59
+ },
60
+ "./client": {
61
+ "types": {
62
+ "default": "./client.d.ts"
63
+ }
64
+ },
65
+ "./next": {
66
+ "types": {
67
+ "default": "./next.d.ts"
68
+ }
69
+ },
70
+ "./server": {
71
+ "types": {
72
+ "default": "./server.d.ts"
73
+ }
74
+ },
75
+ "./experimental": {
76
+ "types": {
77
+ "default": "./experimental.d.ts"
78
+ }
79
+ },
80
+ "./package.json": "./package.json"
81
+ }
54
82
  }
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;