@types/react-dom 17.0.15 → 18.0.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 v17.0 → react-dom}/LICENSE +0 -0
- react-dom v17.0/README.md → react-dom/README.md +3 -3
- react-dom/client.d.ts +40 -0
- react-dom/experimental.d.ts +35 -0
- react-dom v17.0/index.d.ts → react-dom/index.d.ts +5 -1
- react-dom/next.d.ts +34 -0
- react-dom v17.0/package.json → react-dom/package.json +32 -4
- react-dom/server.d.ts +119 -0
- {react-dom v17.0 → react-dom}/test-utils/index.d.ts +0 -0
- react-dom v17.0/node-stream/index.d.ts +0 -18
- react-dom v17.0/server.d.ts +0 -47
File without changes
|
@@ -5,12 +5,12 @@
|
|
5
5
|
This package contains type definitions for React (react-dom) (https://reactjs.org).
|
6
6
|
|
7
7
|
# Details
|
8
|
-
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom
|
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,
|
11
|
+
* Last updated: Thu, 21 Apr 2022 18:01:42 GMT
|
12
12
|
* Dependencies: [@types/react](https://npmjs.com/package/@types/react)
|
13
|
-
* Global values: `ReactDOM`, `
|
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).
|
react-dom/client.d.ts
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
/**
|
2
|
+
* WARNING: This entrypoint is only available starting with `react-dom@18.0.0-rc.1`
|
3
|
+
*/
|
4
|
+
|
5
|
+
// See https://github.com/facebook/react/blob/main/packages/react-dom/client.js to see how the exports are declared,
|
6
|
+
|
7
|
+
import React = require('react');
|
8
|
+
export interface HydrationOptions {
|
9
|
+
/**
|
10
|
+
* Prefix for `useId`.
|
11
|
+
*/
|
12
|
+
identifierPrefix?: string;
|
13
|
+
onRecoverableError?: (error: unknown) => void;
|
14
|
+
}
|
15
|
+
|
16
|
+
export interface RootOptions {
|
17
|
+
/**
|
18
|
+
* Prefix for `useId`.
|
19
|
+
*/
|
20
|
+
identifierPrefix?: string;
|
21
|
+
onRecoverableError?: (error: unknown) => void;
|
22
|
+
}
|
23
|
+
|
24
|
+
export interface Root {
|
25
|
+
render(children: React.ReactChild | Iterable<React.ReactNode>): void;
|
26
|
+
unmount(): void;
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Replaces `ReactDOM.render` when the `.render` method is called and enables Concurrent Mode.
|
31
|
+
*
|
32
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#createroot
|
33
|
+
*/
|
34
|
+
export function createRoot(container: Element | DocumentFragment, options?: RootOptions): Root;
|
35
|
+
|
36
|
+
export function hydrateRoot(
|
37
|
+
container: Element | Document,
|
38
|
+
initialChildren: React.ReactChild | Iterable<React.ReactNode>,
|
39
|
+
options?: HydrationOptions,
|
40
|
+
): Root;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/**
|
2
|
+
* These are types for things that are present in the `experimental` builds of React but not yet
|
3
|
+
* on a stable build.
|
4
|
+
*
|
5
|
+
* Once they are promoted to stable they can just be moved to the main index file.
|
6
|
+
*
|
7
|
+
* To load the types declared here in an actual project, there are three ways. The easiest one,
|
8
|
+
* if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
|
9
|
+
* is to add `"react-dom/experimental"` to the `"types"` array.
|
10
|
+
*
|
11
|
+
* Alternatively, a specific import syntax can to be used from a typescript file.
|
12
|
+
* This module does not exist in reality, which is why the {} is important:
|
13
|
+
*
|
14
|
+
* ```ts
|
15
|
+
* import {} from 'react-dom/experimental'
|
16
|
+
* ```
|
17
|
+
*
|
18
|
+
* It is also possible to include it through a triple-slash reference:
|
19
|
+
*
|
20
|
+
* ```ts
|
21
|
+
* /// <reference types="react-dom/experimental" />
|
22
|
+
* ```
|
23
|
+
*
|
24
|
+
* Either the import or the reference only needs to appear once, anywhere in the project.
|
25
|
+
*/
|
26
|
+
|
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
|
29
|
+
|
30
|
+
import React = require('react');
|
31
|
+
import ReactDOM = require('./next');
|
32
|
+
|
33
|
+
export {};
|
34
|
+
|
35
|
+
declare module '.' {}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Type definitions for React (react-dom)
|
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,6 +10,10 @@
|
|
10
10
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
11
11
|
// TypeScript Version: 2.8
|
12
12
|
|
13
|
+
// NOTE: Users of the `experimental` builds of React should add a reference
|
14
|
+
// to 'react-dom/experimental' in their project. See experimental.d.ts's top comment
|
15
|
+
// for reference and documentation on how exactly to do it.
|
16
|
+
|
13
17
|
export as namespace ReactDOM;
|
14
18
|
|
15
19
|
import {
|
react-dom/next.d.ts
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
/**
|
2
|
+
* These are types for things that are present in the upcoming React 18 release.
|
3
|
+
*
|
4
|
+
* Once React 18 is released they can just be moved to the main index file.
|
5
|
+
*
|
6
|
+
* To load the types declared here in an actual project, there are three ways. The easiest one,
|
7
|
+
* if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
|
8
|
+
* is to add `"react-dom/next"` to the `"types"` array.
|
9
|
+
*
|
10
|
+
* Alternatively, a specific import syntax can to be used from a typescript file.
|
11
|
+
* This module does not exist in reality, which is why the {} is important:
|
12
|
+
*
|
13
|
+
* ```ts
|
14
|
+
* import {} from 'react-dom/next'
|
15
|
+
* ```
|
16
|
+
*
|
17
|
+
* It is also possible to include it through a triple-slash reference:
|
18
|
+
*
|
19
|
+
* ```ts
|
20
|
+
* /// <reference types="react-dom/next" />
|
21
|
+
* ```
|
22
|
+
*
|
23
|
+
* Either the import or the reference only needs to appear once, anywhere in the project.
|
24
|
+
*/
|
25
|
+
|
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
|
28
|
+
|
29
|
+
import React = require('react');
|
30
|
+
import ReactDOM = require('.');
|
31
|
+
|
32
|
+
export {};
|
33
|
+
|
34
|
+
declare module '.' {}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react-dom",
|
3
|
-
"version": "
|
3
|
+
"version": "18.0.2",
|
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",
|
@@ -47,8 +47,36 @@
|
|
47
47
|
},
|
48
48
|
"scripts": {},
|
49
49
|
"dependencies": {
|
50
|
-
"@types/react": "
|
50
|
+
"@types/react": "*"
|
51
51
|
},
|
52
|
-
"typesPublisherContentHash": "
|
53
|
-
"typeScriptVersion": "3.9"
|
52
|
+
"typesPublisherContentHash": "72a20209680e5c96e111d54d943c23ee84ae698daf720273739b5f72b1f276a1",
|
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
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
// forward declarations
|
2
|
+
declare global {
|
3
|
+
namespace NodeJS {
|
4
|
+
// tslint:disable-next-line:no-empty-interface
|
5
|
+
interface ReadableStream {}
|
6
|
+
|
7
|
+
// tslint:disable-next-line:no-empty-interface
|
8
|
+
interface WritableStream {}
|
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 {}
|
22
|
+
}
|
23
|
+
|
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;
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Render a React element to its initial HTML. This should only be used on the server.
|
57
|
+
* React will return an HTML string. You can use this method to generate HTML on the server
|
58
|
+
* and send the markup down on the initial request for faster page loads and to allow search
|
59
|
+
* engines to crawl your pages for SEO purposes.
|
60
|
+
*
|
61
|
+
* If you call `ReactDOM.hydrate()` on a node that already has this server-rendered markup,
|
62
|
+
* React will preserve it and only attach event handlers, allowing you
|
63
|
+
* to have a very performant first-load experience.
|
64
|
+
*/
|
65
|
+
export function renderToString(element: ReactElement): string;
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Render a React element to its initial HTML. Returns a Readable stream that outputs
|
69
|
+
* an HTML string. The HTML output by this stream is exactly equal to what
|
70
|
+
* `ReactDOMServer.renderToString()` would return.
|
71
|
+
*
|
72
|
+
* @deprecated
|
73
|
+
*/
|
74
|
+
export function renderToNodeStream(element: ReactElement): NodeJS.ReadableStream;
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Similar to `renderToString`, except this doesn't create extra DOM attributes
|
78
|
+
* such as `data-reactid`, that React uses internally. This is useful if you want
|
79
|
+
* to use React as a simple static page generator, as stripping away the extra
|
80
|
+
* attributes can save lots of bytes.
|
81
|
+
*/
|
82
|
+
export function renderToStaticMarkup(element: ReactElement): string;
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Similar to `renderToNodeStream`, except this doesn't create extra DOM attributes
|
86
|
+
* such as `data-reactid`, that React uses internally. The HTML output by this stream
|
87
|
+
* is exactly equal to what `ReactDOMServer.renderToStaticMarkup()` would return.
|
88
|
+
*/
|
89
|
+
export function renderToStaticNodeStream(element: ReactElement): NodeJS.ReadableStream;
|
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
|
+
|
117
|
+
export const version: string;
|
118
|
+
|
119
|
+
export as namespace ReactDOMServer;
|
File without changes
|
@@ -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;
|
react-dom v17.0/server.d.ts
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
// forward declarations
|
2
|
-
declare global {
|
3
|
-
namespace NodeJS {
|
4
|
-
// tslint:disable-next-line:no-empty-interface
|
5
|
-
interface ReadableStream {}
|
6
|
-
}
|
7
|
-
}
|
8
|
-
|
9
|
-
import { ReactElement } from 'react';
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Render a React element to its initial HTML. This should only be used on the server.
|
13
|
-
* React will return an HTML string. You can use this method to generate HTML on the server
|
14
|
-
* and send the markup down on the initial request for faster page loads and to allow search
|
15
|
-
* engines to crawl your pages for SEO purposes.
|
16
|
-
*
|
17
|
-
* If you call `ReactDOM.hydrate()` on a node that already has this server-rendered markup,
|
18
|
-
* React will preserve it and only attach event handlers, allowing you
|
19
|
-
* to have a very performant first-load experience.
|
20
|
-
*/
|
21
|
-
export function renderToString(element: ReactElement): string;
|
22
|
-
|
23
|
-
/**
|
24
|
-
* Render a React element to its initial HTML. Returns a Readable stream that outputs
|
25
|
-
* an HTML string. The HTML output by this stream is exactly equal to what
|
26
|
-
* `ReactDOMServer.renderToString()` would return.
|
27
|
-
*/
|
28
|
-
export function renderToNodeStream(element: ReactElement): NodeJS.ReadableStream;
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Similar to `renderToString`, except this doesn't create extra DOM attributes
|
32
|
-
* such as `data-reactid`, that React uses internally. This is useful if you want
|
33
|
-
* to use React as a simple static page generator, as stripping away the extra
|
34
|
-
* attributes can save lots of bytes.
|
35
|
-
*/
|
36
|
-
export function renderToStaticMarkup(element: ReactElement): string;
|
37
|
-
|
38
|
-
/**
|
39
|
-
* Similar to `renderToNodeStream`, except this doesn't create extra DOM attributes
|
40
|
-
* such as `data-reactid`, that React uses internally. The HTML output by this stream
|
41
|
-
* is exactly equal to what `ReactDOMServer.renderToStaticMarkup()` would return.
|
42
|
-
*/
|
43
|
-
export function renderToStaticNodeStream(element: ReactElement): NodeJS.ReadableStream;
|
44
|
-
|
45
|
-
export const version: string;
|
46
|
-
|
47
|
-
export as namespace ReactDOMServer;
|