Skip to content

Commit 70d0975

Browse files
author
Ali Nasserzadeh
committed
Unified all waitForOptions types to one single type
1 parent 4330d34 commit 70d0975

File tree

5 files changed

+23
-29
lines changed

5 files changed

+23
-29
lines changed

types/queries.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Matcher, MatcherOptions } from './matches';
22
import { SelectorMatcherOptions } from './query-helpers';
3-
import { WaitForElementOptions } from './wait-for-element';
3+
import { waitForOptions } from 'wait-for';
44

55
export type QueryByBoundAttribute = (
66
container: HTMLElement,
@@ -14,7 +14,7 @@ export type FindAllByBoundAttribute = (
1414
container: HTMLElement,
1515
id: Matcher,
1616
options?: MatcherOptions,
17-
waitForElementOptions?: WaitForElementOptions,
17+
waitForElementOptions?: waitForOptions,
1818
) => Promise<HTMLElement[]>;
1919

2020
export type GetByBoundAttribute = (container: HTMLElement, id: Matcher, options?: MatcherOptions) => HTMLElement;
@@ -23,7 +23,7 @@ export type FindByBoundAttribute = (
2323
container: HTMLElement,
2424
id: Matcher,
2525
options?: MatcherOptions,
26-
waitForElementOptions?: WaitForElementOptions,
26+
waitForElementOptions?: waitForOptions,
2727
) => Promise<HTMLElement>;
2828

2929
export type QueryByText = (container: HTMLElement, id: Matcher, options?: SelectorMatcherOptions) => HTMLElement | null;
@@ -34,7 +34,7 @@ export type FindAllByText = (
3434
container: HTMLElement,
3535
id: Matcher,
3636
options?: SelectorMatcherOptions,
37-
waitForElementOptions?: WaitForElementOptions,
37+
waitForElementOptions?: waitForOptions,
3838
) => Promise<HTMLElement[]>;
3939

4040
export type GetByText = (container: HTMLElement, id: Matcher, options?: SelectorMatcherOptions) => HTMLElement;
@@ -43,7 +43,7 @@ export type FindByText = (
4343
container: HTMLElement,
4444
id: Matcher,
4545
options?: SelectorMatcherOptions,
46-
waitForElementOptions?: WaitForElementOptions,
46+
waitForElementOptions?: waitForOptions,
4747
) => Promise<HTMLElement>;
4848

4949
export interface ByRoleOptions extends MatcherOptions {
@@ -74,14 +74,14 @@ export type FindByRole = (
7474
container: HTMLElement,
7575
role: Matcher,
7676
options?: ByRoleOptions,
77-
waitForElementOptions?: WaitForElementOptions,
77+
waitForElementOptions?: waitForOptions,
7878
) => Promise<HTMLElement>;
7979

8080
export type FindAllByRole = (
8181
container: HTMLElement,
8282
role: Matcher,
8383
options?: ByRoleOptions,
84-
waitForElementOptions?: WaitForElementOptions,
84+
waitForElementOptions?: waitForOptions,
8585
) => Promise<HTMLElement[]>;
8686

8787
export const getByLabelText: GetByText;

types/wait-for-dom-change.d.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export function waitForDomChange(options?: {
2-
container?: HTMLElement;
3-
timeout?: number;
4-
mutationObserverOptions?: MutationObserverInit;
5-
}): Promise<any>;
1+
import { waitForOptions } from "index";
2+
3+
export function waitForDomChange(options?: waitForOptions): Promise<any>;
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
import { waitForOptions } from "wait-for";
2+
13
export function waitForElementToBeRemoved<T>(
24
callback: (() => T) | T,
3-
options?: {
4-
container?: HTMLElement;
5-
timeout?: number;
6-
mutationObserverOptions?: MutationObserverInit;
7-
},
5+
options?: waitForOptions,
86
): Promise<T>;

types/wait-for-element.d.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
export interface WaitForElementOptions {
2-
container?: HTMLElement;
3-
timeout?: number;
4-
mutationObserverOptions?: MutationObserverInit;
5-
}
1+
import { waitForOptions } from "wait-for";
62

7-
export function waitForElement<T>(callback: () => T, options?: WaitForElementOptions): Promise<T>;
3+
export function waitForElement<T>(callback: () => T, options?: waitForOptions): Promise<T>;

types/wait-for.d.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
export interface waitForOptions {
2+
container?: HTMLElement;
3+
timeout?: number;
4+
interval?: number;
5+
mutationObserverOptions?: MutationObserverInit;
6+
}
7+
18
export function waitFor<T>(
29
callback: () => T,
3-
options?: {
4-
container?: HTMLElement;
5-
timeout?: number;
6-
interval?: number;
7-
mutationObserverOptions?: MutationObserverInit;
8-
},
10+
options?: waitForOptions,
911
): Promise<T>;

0 commit comments

Comments
 (0)