DefinitelyTyped/types/react-test-renderer/index.d.ts
Nathan Brown 8f42dfbc91 [react-test-renderer] Include update() and getInstance()
Added missing functions to definition of `react-test-renderer`.  Also renamed `create()` return type to match Flow type name in React repository.
2017-07-14 13:24:38 -07:00

26 lines
1.1 KiB
TypeScript

// Type definitions for react-test-renderer 15.5
// Project: https://facebook.github.io/react/
// Definitions by: Arvitaly <https://github.com/arvitaly>, Lochbrunner <https://github.com/lochbrunner>, Lochbrunner <https://github.com/lochbrunner>, John Reilly <https://github.com/johnnyreilly/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { ReactElement } from "react";
export interface ReactTestInstance {
toJSON(): ReactTestRendererJSON;
unmount(nextElement?: ReactElement<any>): void;
update(nextElement: ReactElement<any>): void;
getInstance(): any;
}
export interface ReactTestRendererJSON {
type: string;
props: { [propName: string]: string };
children: null | Array<string | ReactTestRendererJSON>;
$$typeof?: any;
}
export interface TestRendererOptions {
createNodeMock(element: ReactElement<any>): any;
}
// https://github.com/facebook/react/blob/master/src/renderers/testing/ReactTestMount.js#L155
export function create(nextElement: ReactElement<any>, options?: TestRendererOptions): ReactTestInstance;