@types/react-dom 16.9.2 → 16.9.6
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 +6 -6
- react-dom/experimental.d.ts +102 -0
- react-dom/index.d.ts +12 -38
- react-dom/package.json +3 -3
- react-dom/server/index.d.ts +1 -1
- react-dom/test-utils/index.d.ts +1 -1
react-dom/README.md
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
This package contains type definitions for React (react-dom) (http://facebook.github.io/react/).
|
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
|
-
Additional Details
|
11
|
-
* Last updated:
|
12
|
-
* Dependencies: @types/react
|
13
|
-
* Global values: ReactDOM
|
10
|
+
### Additional Details
|
11
|
+
* Last updated: Tue, 31 Mar 2020 21:43:51 GMT
|
12
|
+
* Dependencies: [@types/react](https://npmjs.com/package/@types/react)
|
13
|
+
* Global values: `ReactDOM`, `ReactDOMNodeStream`, `ReactDOMServer`
|
14
14
|
|
15
15
|
# Credits
|
16
|
-
These definitions were written by Asana
|
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), and [Jessica Franco](https://github.com/Jessidhia).
|
@@ -0,0 +1,102 @@
|
|
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/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__`.
|
30
|
+
|
31
|
+
import React = require('react');
|
32
|
+
import ReactDOM = require('.');
|
33
|
+
|
34
|
+
export {};
|
35
|
+
|
36
|
+
declare module '.' {
|
37
|
+
// enableSuspenseServerRenderer feature
|
38
|
+
interface HydrationOptions {
|
39
|
+
onHydrated?(suspenseInstance: Comment): void;
|
40
|
+
onDeleted?(suspenseInstance: Comment): void;
|
41
|
+
}
|
42
|
+
|
43
|
+
// exposeConcurrentModeAPIs features
|
44
|
+
|
45
|
+
interface RootOptions {
|
46
|
+
hydrate?: boolean;
|
47
|
+
hydrationOptions?: HydrationOptions;
|
48
|
+
}
|
49
|
+
|
50
|
+
interface Root {
|
51
|
+
render(children: React.ReactChild | React.ReactNodeArray, callback?: () => void): void;
|
52
|
+
unmount(callback?: () => void): void;
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Replaces `ReactDOM.render` when the `.render` method is called and enables Blocking Mode.
|
57
|
+
*
|
58
|
+
* Opting into Concurrent Mode introduces semantic changes to how React works.
|
59
|
+
* This means that you can’t use Concurrent Mode in just a few components.
|
60
|
+
* Because of this, some apps may not be able to migrate directly to Concurrent Mode.
|
61
|
+
* Blocking Mode only contains a small subset of Concurrent Mode features and is intended
|
62
|
+
* as an intermediary migration step for apps that are unable to migrate directly.
|
63
|
+
*
|
64
|
+
* @see https://reactjs.org/docs/concurrent-mode-adoption.html#migration-step-blocking-mode
|
65
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#createblockingroot
|
66
|
+
*/
|
67
|
+
function createBlockingRoot(
|
68
|
+
container: Element | Document | DocumentFragment | Comment,
|
69
|
+
options?: RootOptions,
|
70
|
+
): Root;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Replaces `ReactDOM.render` when the `.render` method is called and enables Concurrent Mode.
|
74
|
+
*
|
75
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#createroot
|
76
|
+
*/
|
77
|
+
function createRoot(container: Element | Document | DocumentFragment | Comment, options?: RootOptions): Root;
|
78
|
+
|
79
|
+
function unstable_discreteUpdates<R>(callback: () => R): R;
|
80
|
+
|
81
|
+
function unstable_discreteUpdates<R, A1>(callback: (a1: A1) => R, a1: A1): R;
|
82
|
+
|
83
|
+
function unstable_discreteUpdates<R, A1, A2>(callback: (a1: A1, a2: A2) => R, a1: A1, a2: A2): R;
|
84
|
+
|
85
|
+
function unstable_discreteUpdates<R, A1, A2, A3>(
|
86
|
+
callback: (a1: A1, a2: A2, a3: A3) => R,
|
87
|
+
a1: A1,
|
88
|
+
a2: A2,
|
89
|
+
a3: A3,
|
90
|
+
): R;
|
91
|
+
|
92
|
+
function unstable_flushDiscreteUpdates(): void;
|
93
|
+
|
94
|
+
function unstable_flushControlled(callback: () => void): void;
|
95
|
+
|
96
|
+
// enableSelectiveHydration feature
|
97
|
+
|
98
|
+
/**
|
99
|
+
* @see https://github.com/facebook/react/commit/3a2b5f148d450c69aab67f055fc441d294c23518
|
100
|
+
*/
|
101
|
+
function unstable_scheduleHydration(target: Element | Document | DocumentFragment | Comment): void;
|
102
|
+
}
|
react-dom/index.d.ts
CHANGED
@@ -9,6 +9,10 @@
|
|
9
9
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
10
10
|
// TypeScript Version: 2.8
|
11
11
|
|
12
|
+
// NOTE: Users of the `experimental` builds of React should add a reference
|
13
|
+
// to 'react-dom/experimental' in their project. See experimental.d.ts's top comment
|
14
|
+
// for reference and documentation on how exactly to do it.
|
15
|
+
|
12
16
|
export as namespace ReactDOM;
|
13
17
|
|
14
18
|
import {
|
@@ -18,7 +22,7 @@ import {
|
|
18
22
|
} from 'react';
|
19
23
|
|
20
24
|
export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text;
|
21
|
-
export function unmountComponentAtNode(container: Element): boolean;
|
25
|
+
export function unmountComponentAtNode(container: Element | DocumentFragment): boolean;
|
22
26
|
|
23
27
|
export function createPortal(children: ReactNode, container: Element, key?: null | string): ReactPortal;
|
24
28
|
|
@@ -52,73 +56,43 @@ export interface Renderer {
|
|
52
56
|
|
53
57
|
<T extends Element>(
|
54
58
|
element: DOMElement<DOMAttributes<T>, T>,
|
55
|
-
container: Element | null,
|
59
|
+
container: Element | DocumentFragment | null,
|
56
60
|
callback?: () => void
|
57
61
|
): T;
|
58
62
|
|
59
63
|
(
|
60
64
|
element: Array<DOMElement<DOMAttributes<any>, any>>,
|
61
|
-
container: Element | null,
|
65
|
+
container: Element | DocumentFragment | null,
|
62
66
|
callback?: () => void
|
63
67
|
): Element;
|
64
68
|
|
65
69
|
(
|
66
70
|
element: SFCElement<any> | Array<SFCElement<any>>,
|
67
|
-
container: Element | null,
|
71
|
+
container: Element | DocumentFragment | null,
|
68
72
|
callback?: () => void
|
69
73
|
): void;
|
70
74
|
|
71
75
|
<P, T extends Component<P, ComponentState>>(
|
72
76
|
element: CElement<P, T>,
|
73
|
-
container: Element | null,
|
77
|
+
container: Element | DocumentFragment | null,
|
74
78
|
callback?: () => void
|
75
79
|
): T;
|
76
80
|
|
77
81
|
(
|
78
82
|
element: Array<CElement<any, Component<any, ComponentState>>>,
|
79
|
-
container: Element | null,
|
83
|
+
container: Element | DocumentFragment | null,
|
80
84
|
callback?: () => void
|
81
85
|
): Component<any, ComponentState>;
|
82
86
|
|
83
87
|
<P>(
|
84
88
|
element: ReactElement<P>,
|
85
|
-
container: Element | null,
|
89
|
+
container: Element | DocumentFragment | null,
|
86
90
|
callback?: () => void
|
87
91
|
): Component<P, ComponentState> | Element | void;
|
88
92
|
|
89
93
|
(
|
90
94
|
element: ReactElement[],
|
91
|
-
container: Element | null,
|
95
|
+
container: Element | DocumentFragment | null,
|
92
96
|
callback?: () => void
|
93
97
|
): Component<any, ComponentState> | Element | void;
|
94
98
|
}
|
95
|
-
|
96
|
-
export interface Work {
|
97
|
-
then(onCommit?: () => void): void;
|
98
|
-
}
|
99
|
-
|
100
|
-
export interface Batch {
|
101
|
-
commit(): void;
|
102
|
-
render(children: React.ReactNode): Work;
|
103
|
-
then(onComplete?: () => void): void;
|
104
|
-
}
|
105
|
-
|
106
|
-
export interface RootOptions {
|
107
|
-
hydrate?: boolean;
|
108
|
-
}
|
109
|
-
|
110
|
-
export interface SyncRoot {
|
111
|
-
render(children: React.ReactNode, callback?: () => void): Work;
|
112
|
-
unmount(callback?: () => void): void;
|
113
|
-
}
|
114
|
-
|
115
|
-
export function unstable_createSyncRoot(container: Element, options?: RootOptions): SyncRoot;
|
116
|
-
|
117
|
-
export interface Root extends SyncRoot {
|
118
|
-
createBatch(): Batch;
|
119
|
-
}
|
120
|
-
|
121
|
-
export function unstable_createRoot(
|
122
|
-
container: Element,
|
123
|
-
options?: RootOptions
|
124
|
-
): Root;
|
react-dom/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react-dom",
|
3
|
-
"version": "16.9.
|
3
|
+
"version": "16.9.6",
|
4
4
|
"description": "TypeScript definitions for React (react-dom)",
|
5
5
|
"license": "MIT",
|
6
6
|
"contributors": [
|
@@ -33,7 +33,7 @@
|
|
33
33
|
}
|
34
34
|
],
|
35
35
|
"main": "",
|
36
|
-
"types": "index",
|
36
|
+
"types": "index.d.ts",
|
37
37
|
"repository": {
|
38
38
|
"type": "git",
|
39
39
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
@@ -43,6 +43,6 @@
|
|
43
43
|
"dependencies": {
|
44
44
|
"@types/react": "*"
|
45
45
|
},
|
46
|
-
"typesPublisherContentHash": "
|
46
|
+
"typesPublisherContentHash": "6a13b83e378d549ddeae772447c4a211ba2d108e21786e64d706321289320543",
|
47
47
|
"typeScriptVersion": "2.8"
|
48
48
|
}
|
react-dom/server/index.d.ts
CHANGED
@@ -14,7 +14,7 @@ import { ReactElement } from 'react';
|
|
14
14
|
* and send the markup down on the initial request for faster page loads and to allow search
|
15
15
|
* engines to crawl your pages for SEO purposes.
|
16
16
|
*
|
17
|
-
* If you call `ReactDOM.
|
17
|
+
* If you call `ReactDOM.hydrate()` on a node that already has this server-rendered markup,
|
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
|
*/
|
react-dom/test-utils/index.d.ts
CHANGED
@@ -287,7 +287,7 @@ export function createRenderer(): ShallowRenderer;
|
|
287
287
|
* @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
|
288
288
|
*/
|
289
289
|
// the "void | undefined" is here to forbid any sneaky "Promise" returns.
|
290
|
-
export function act(callback: () => void | undefined):
|
290
|
+
export function act(callback: () => void | undefined): void;
|
291
291
|
// the "void | undefined" is here to forbid any sneaky return values
|
292
292
|
// tslint:disable-next-line: void-return
|
293
293
|
export function act(callback: () => Promise<void | undefined>): Promise<undefined>;
|