UNPKG

3.53 kBTypeScriptView Raw
1// Type definitions for React (react-dom) 16.8
2// Project: http://facebook.github.io/react/
3// Definitions by: Asana <https://asana.com>
4// AssureSign <http://www.assuresign.com>
5// Microsoft <https://microsoft.com>
6// MartynasZilinskas <https://github.com/MartynasZilinskas>
7// Josh Rutherford <https://github.com/theruther4d>
8// Jessica Franco <https://github.com/Jessidhia>
9// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
10// TypeScript Version: 2.8
11
12export as namespace ReactDOM;
13
14import {
15 ReactInstance, Component, ComponentState,
16 ReactElement, SFCElement, CElement,
17 DOMAttributes, DOMElement, ReactNode, ReactPortal
18} from 'react';
19
20export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text;
21export function unmountComponentAtNode(container: Element): boolean;
22
23export function createPortal(children: ReactNode, container: Element, key?: null | string): ReactPortal;
24
25export const version: string;
26export const render: Renderer;
27export const hydrate: Renderer;
28
29export function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
30export function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
31export function unstable_batchedUpdates(callback: () => any): void;
32
33export function unstable_renderSubtreeIntoContainer<T extends Element>(
34 parentComponent: Component<any>,
35 element: DOMElement<DOMAttributes<T>, T>,
36 container: Element,
37 callback?: (element: T) => any): T;
38export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>(
39 parentComponent: Component<any>,
40 element: CElement<P, T>,
41 container: Element,
42 callback?: (component: T) => any): T;
43export function unstable_renderSubtreeIntoContainer<P>(
44 parentComponent: Component<any>,
45 element: ReactElement<P>,
46 container: Element,
47 callback?: (component?: Component<P, ComponentState> | Element) => any): Component<P, ComponentState> | Element | void;
48
49export interface Renderer {
50 // Deprecated(render): The return value is deprecated.
51 // In future releases the render function's return type will be void.
52
53 <T extends Element>(
54 element: DOMElement<DOMAttributes<T>, T>,
55 container: Element | null,
56 callback?: () => void
57 ): T;
58
59 (
60 element: Array<DOMElement<DOMAttributes<any>, any>>,
61 container: Element | null,
62 callback?: () => void
63 ): Element;
64
65 (
66 element: SFCElement<any> | Array<SFCElement<any>>,
67 container: Element | null,
68 callback?: () => void
69 ): void;
70
71 <P, T extends Component<P, ComponentState>>(
72 element: CElement<P, T>,
73 container: Element | null,
74 callback?: () => void
75 ): T;
76
77 (
78 element: Array<CElement<any, Component<any, ComponentState>>>,
79 container: Element | null,
80 callback?: () => void
81 ): Component<any, ComponentState>;
82
83 <P>(
84 element: ReactElement<P>,
85 container: Element | null,
86 callback?: () => void
87 ): Component<P, ComponentState> | Element | void;
88
89 (
90 element: ReactElement[],
91 container: Element | null,
92 callback?: () => void
93 ): Component<any, ComponentState> | Element | void;
94
95 (
96 parentComponent: Component<any> | Array<Component<any>>,
97 element: SFCElement<any>,
98 container: Element,
99 callback?: () => void
100 ): void;
101}