DefinitelyTyped/types/react-dom/index.d.ts
cynecx 0b21b7dd63 [react] [react-dom] Add support for rendering an array of elements (#19363)
* Test

* Fix react typings

* Revert "Use []-syntax for some cases."

This reverts commit 5f6e55843980b2cff9ace4174f72b4f8aa7ad278.

* Modify another render function's return type

* Use Array<T> instead in react.d.ts & Fix issues with the typescript linter & Adapt changes in react-router

* Convert Array<T> to T[]

* Add support for string and number return types.
2017-10-06 19:08:29 +01:00

98 lines
3.2 KiB
TypeScript

// Type definitions for React (react-dom) 16.0
// Project: http://facebook.github.io/react/
// Definitions by: Asana <https://asana.com>
// AssureSign <http://www.assuresign.com>
// Microsoft <https://microsoft.com>
// MartynasZilinskas <https://github.com/MartynasZilinskas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export as namespace ReactDOM;
import {
ReactInstance, Component, ComponentState,
ReactElement, SFCElement, CElement,
DOMAttributes, DOMElement
} from 'react';
export function findDOMNode(instance: ReactInstance): Element;
export function unmountComponentAtNode(container: Element): boolean;
export const version: string;
export const render: Renderer;
export const hydrate: Renderer;
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 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: Element | null,
callback?: () => void
): T;
(
element: Array<DOMElement<DOMAttributes<any>, any>>,
container: Element | null,
callback?: () => void
): Element;
(
element: SFCElement<any> | Array<SFCElement<any>>,
container: Element | null,
callback?: () => void
): void;
<P, T extends Component<P, ComponentState>>(
element: CElement<P, T>,
container: Element | null,
callback?: () => void
): T;
(
element: Array<CElement<any, Component<any, ComponentState>>>,
container: Element | null,
callback?: () => void
): Component<any, ComponentState>;
<P>(
element: ReactElement<P>,
container: Element | null,
callback?: () => void
): Component<P, ComponentState> | Element | void;
(
element: Array<ReactElement<any>>,
container: Element | null,
callback?: () => void
): Component<any, ComponentState> | Element | void;
(
parentComponent: Component<any> | Array<Component<any>>,
element: SFCElement<any>,
container: Element,
callback?: () => void
): void;
}