Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Fix TypeScript return types for query methods #21

Merged
merged 1 commit into from
May 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions typings/queries.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,70 @@ import { ReactTestRenderer } from 'react-test-renderer';

import { Matcher, MatcherOptions } from './matches';
import { WaitForElementOptions } from './wait-for-element';
import { SelectorMatcherOptions } from './query-helpers';
import { NativeTestInstance, SelectorMatcherOptions } from './query-helpers';

export type QueryByBoundProp = (
testRenderer: ReactTestRenderer,
id: Matcher,
options?: MatcherOptions,
) => ReactTestRenderer | null;
) => NativeTestInstance | null;

export type AllByBoundProp = (
testRenderer: ReactTestRenderer,
id: Matcher,
options?: MatcherOptions,
) => ReactTestRenderer[];
) => NativeTestInstance[];

export type FindAllByBoundProp = (
testRenderer: ReactTestRenderer,
id: Matcher,
options?: MatcherOptions,
) => Promise<ReactTestRenderer[]>;
) => Promise<NativeTestInstance[]>;

export type GetByBoundProp = (
testRenderer: ReactTestRenderer,
id: Matcher,
options?: MatcherOptions,
) => ReactTestRenderer;
) => NativeTestInstance;

export type FindByBoundProp = (
testRenderer: ReactTestRenderer,
id: Matcher,
options?: MatcherOptions,
waitForElementOptions?: WaitForElementOptions,
) => Promise<ReactTestRenderer>;
) => Promise<NativeTestInstance>;

export type QueryByText = (
testRenderer: ReactTestRenderer,
id: Matcher,
options?: SelectorMatcherOptions,
) => ReactTestRenderer | null;
) => NativeTestInstance | null;

export type AllByText = (
testRenderer: ReactTestRenderer,
id: Matcher,
options?: SelectorMatcherOptions,
) => ReactTestRenderer[];
) => NativeTestInstance[];

export type FindAllByText = (
testRenderer: ReactTestRenderer,
id: Matcher,
options?: MatcherOptions,
waitForElementOptions?: WaitForElementOptions,
) => Promise<ReactTestRenderer[]>;
) => Promise<NativeTestInstance[]>;

export type GetByText = (
testRenderer: ReactTestRenderer,
id: Matcher,
options?: WaitForElementOptions,
) => ReactTestRenderer;
) => NativeTestInstance;

export type FindByText = (
testRenderer: ReactTestRenderer,
id: Matcher,
options?: MatcherOptions,
waitForElementOptions?: WaitForElementOptions,
) => Promise<ReactTestRenderer>;
) => Promise<NativeTestInstance>;

export const getByHintText: GetByBoundProp;
export const getByLabelText: GetByBoundProp;
Expand Down