diff --git a/flow-typed/npm/enzyme_v3.x.x.js b/flow-typed/npm/enzyme_v3.x.x.js index 1105094..31d3431 100644 --- a/flow-typed/npm/enzyme_v3.x.x.js +++ b/flow-typed/npm/enzyme_v3.x.x.js @@ -1,48 +1,53 @@ -// flow-typed signature: e50486ad88c5bbfcdfde9fef4fc4c5d1 -// flow-typed version: ab187b275b/enzyme_v3.x.x/flow_>=v0.53.x - -import * as React from "react"; +// flow-typed signature: 1b68a1969e8305bf53fbaa98b4a5aaae +// flow-typed version: f7ac3b9713/enzyme_v3.x.x/flow_>=v0.104.x declare module "enzyme" { - declare type PredicateFunction = ( + declare type PredicateFunction> = ( wrapper: T, index: number ) => boolean; - declare type NodeOrNodes = React.Node | Array; - declare type EnzymeSelector = string | Class> | Object; + declare type UntypedSelector = string | { [key: string]: number|string|boolean, ... }; + declare type EnzymeSelector = UntypedSelector | React$ElementType; // CheerioWrapper is a type alias for an actual cheerio instance // TODO: Reference correct type from cheerio's type declarations declare type CheerioWrapper = any; - declare class Wrapper { - find(selector: EnzymeSelector): this, + declare class Wrapper { + equals(node: React$Element): boolean, + find(selector: UntypedSelector): this, + find(selector: T): ReactWrapper, findWhere(predicate: PredicateFunction): this, - filter(selector: EnzymeSelector): this, + filter(selector: UntypedSelector): this, + filter(selector: T): ReactWrapper, filterWhere(predicate: PredicateFunction): this, hostNodes(): this, - contains(nodeOrNodes: NodeOrNodes): boolean, - containsMatchingElement(node: React.Node): boolean, - containsAllMatchingElements(nodes: NodeOrNodes): boolean, - containsAnyMatchingElements(nodes: NodeOrNodes): boolean, - dive(option?: { context?: Object }): this, - exists(): boolean, + contains(nodes: React$Node): boolean, + containsMatchingElement(node: React$Node): boolean, + containsAllMatchingElements(nodes: React$Node): boolean, + containsAnyMatchingElements(nodes: React$Node): boolean, + dive(option?: { context?: Object, ... }): this, + exists(selector?: EnzymeSelector): boolean, isEmptyRender(): boolean, - matchesElement(node: React.Node): boolean, + matchesElement(node: React$Node): boolean, hasClass(className: string): boolean, is(selector: EnzymeSelector): boolean, isEmpty(): boolean, not(selector: EnzymeSelector): this, - children(selector?: EnzymeSelector): this, + children(selector?: UntypedSelector): this, + children(selector: T): ReactWrapper, childAt(index: number): this, - parents(selector?: EnzymeSelector): this, + parents(selector?: UntypedSelector): this, + parents(selector: T): ReactWrapper, parent(): this, - closest(selector: EnzymeSelector): this, + closest(selector: UntypedSelector): this, + closest(selector: T): ReactWrapper, render(): CheerioWrapper, + renderProp(propName: string): (...args: Array) => this, unmount(): this, text(): string, html(): string, - get(index: number): React.Node, + get(index: number): React$Node, getDOMNode(): HTMLElement | HTMLInputElement, at(index: number): this, first(): this, @@ -53,11 +58,12 @@ declare module "enzyme" { prop(key: string): any, key(): string, simulate(event: string, ...args: Array): this, + simulateError(error: Error): this, slice(begin?: number, end?: number): this, - setState(state: {}, callback?: Function): this, - setProps(props: {}): this, + setState(state: {...}, callback?: () => void): this, + setProps(props: {...}, callback?: () => void): this, setContext(context: Object): this, - instance(): React.Component<*, *>, + instance(): React$ElementRef, update(): this, debug(options?: Object): string, type(): string | Function | null, @@ -79,51 +85,58 @@ declare module "enzyme" { length: number } - declare class ReactWrapper extends Wrapper { - constructor(nodes: NodeOrNodes, root: any, options?: ?Object): ReactWrapper, + declare class ReactWrapper extends Wrapper { + constructor(nodes: React$Element, root: any, options?: ?Object): ReactWrapper, mount(): this, ref(refName: string): this, detach(): void } - declare class ShallowWrapper extends Wrapper { + declare class ShallowWrapper extends Wrapper { constructor( - nodes: NodeOrNodes, + nodes: React$Element, root: any, options?: ?Object - ): ShallowWrapper, - equals(node: React.Node): boolean, - shallow(options?: { context?: Object }): ShallowWrapper, - getElement(): React.Node, - getElements(): Array + ): ShallowWrapper, + equals(node: React$Node): boolean, + shallow(options?: { context?: Object, ... }): ShallowWrapper, + getElement(): React$Node, + getElements(): Array } - declare function shallow( - node: React.Node, - options?: { context?: Object, disableLifecycleMethods?: boolean } - ): ShallowWrapper; - declare function mount( - node: React.Node, + declare function shallow( + node: React$Element, + options?: { + context?: Object, + disableLifecycleMethods?: boolean, + ... + } + ): ShallowWrapper; + declare function mount( + node: React$Element, options?: { context?: Object, attachTo?: HTMLElement, - childContextTypes?: Object + childContextTypes?: Object, + ... } - ): ReactWrapper; + ): ReactWrapper; declare function render( - node: React.Node, - options?: { context?: Object } + node: React$Node, + options?: { context?: Object, ... } ): CheerioWrapper; declare module.exports: { configure(options: { Adapter?: any, - disableLifecycleMethods?: boolean + disableLifecycleMethods?: boolean, + ... }): void, render: typeof render, mount: typeof mount, shallow: typeof shallow, ShallowWrapper: typeof ShallowWrapper, - ReactWrapper: typeof ReactWrapper + ReactWrapper: typeof ReactWrapper, + ... }; }