forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
104 lines (86 loc) · 3.78 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Type definitions for React (react-dom) 18.0
// Project: https://reactjs.org
// Definitions 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>
// Sebastian Silbermann <https://github.com/eps1lon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// NOTE: Users of the `experimental` builds of React should add a reference
// to 'react-dom/experimental' in their project. See experimental.d.ts's top comment
// for reference and documentation on how exactly to do it.
export as namespace ReactDOM;
import {
ReactInstance, Component, ComponentState,
ReactElement, FunctionComponentElement, CElement,
DOMAttributes, DOMElement, ReactNode, ReactPortal
} from 'react';
export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text;
export function unmountComponentAtNode(container: Element | DocumentFragment): boolean;
export function createPortal(children: ReactNode, container: Element, key?: null | string): ReactPortal;
export const version: string;
export const render: Renderer;
export const hydrate: Renderer;
export function flushSync<R>(fn: () => R): R;
export function flushSync<A, R>(fn: (a: A) => R, a: A): R;
export function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
export function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
export function unstable_batchedUpdates(callback: () => any): void;
export function unstable_renderSubtreeIntoContainer<T extends Element>(
parentComponent: Component<any>,
element: DOMElement<DOMAttributes<T>, T>,
container: Element,
callback?: (element: T) => any): T;
export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>(
parentComponent: Component<any>,
element: CElement<P, T>,
container: Element,
callback?: (component: T) => any): T;
export function unstable_renderSubtreeIntoContainer<P>(
parentComponent: Component<any>,
element: ReactElement<P>,
container: Element,
callback?: (component?: Component<P, ComponentState> | Element) => any): Component<P, ComponentState> | Element | void;
export type Container = Element | Document | DocumentFragment;
export interface Renderer {
// Deprecated(render): The return value is deprecated.
// In future releases the render function's return type will be void.
<T extends Element>(
element: DOMElement<DOMAttributes<T>, T>,
container: Container| null,
callback?: () => void
): T;
(
element: Array<DOMElement<DOMAttributes<any>, any>>,
container: Container| null,
callback?: () => void
): Element;
(
element: FunctionComponentElement<any> | Array<FunctionComponentElement<any>>,
container: Container| null,
callback?: () => void
): void;
<P, T extends Component<P, ComponentState>>(
element: CElement<P, T>,
container: Container| null,
callback?: () => void
): T;
(
element: Array<CElement<any, Component<any, ComponentState>>>,
container: Container| null,
callback?: () => void
): Component<any, ComponentState>;
<P>(
element: ReactElement<P>,
container: Container| null,
callback?: () => void
): Component<P, ComponentState> | Element | void;
(
element: ReactElement[],
container: Container| null,
callback?: () => void
): Component<any, ComponentState> | Element | void;
}