mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(types): proper types for $wait (#514)
This commit is contained in:
parent
6a0dba7b56
commit
f3c53923ab
@ -732,10 +732,10 @@ export class Frame {
|
||||
return this._scheduleRerunnableTask(task, 'main', options.timeout);
|
||||
}
|
||||
|
||||
async $wait(selector: string, pageFunction: Function | string, options?: types.WaitForFunctionOptions, ...args: any[]): Promise<js.JSHandle> {
|
||||
$wait: types.$Wait = async (selector, pageFunction, options, ...args) => {
|
||||
options = { timeout: this._page._timeoutSettings.timeout(), ...(options || {}) };
|
||||
const task = dom.waitForFunctionTask(selector, pageFunction, options, ...args);
|
||||
return this._scheduleRerunnableTask(task, 'main', options.timeout);
|
||||
return this._scheduleRerunnableTask(task, 'main', options.timeout) as any;
|
||||
}
|
||||
|
||||
async title(): Promise<string> {
|
||||
|
||||
@ -503,8 +503,8 @@ export class Page extends platform.EventEmitter {
|
||||
return this.mainFrame().waitForFunction(pageFunction, options, ...args);
|
||||
}
|
||||
|
||||
async $wait(selector: string, pageFunction: Function | string, options?: types.WaitForFunctionOptions, ...args: any[]): Promise<js.JSHandle> {
|
||||
return this.mainFrame().$wait(selector, pageFunction, options, ...args);
|
||||
$wait: types.$Wait = async (selector, pageFunction, options, ...args) => {
|
||||
return this.mainFrame().$wait(selector, pageFunction, options, ...args as any);
|
||||
}
|
||||
|
||||
workers(): Worker[] {
|
||||
|
||||
@ -27,6 +27,7 @@ export type Evaluate = <Args extends any[], R>(pageFunction: PageFunction<Args,
|
||||
export type EvaluateHandle = <Args extends any[], R>(pageFunction: PageFunction<Args, R>, ...args: Boxed<Args>) => Promise<Handle<R>>;
|
||||
export type $Eval = <Args extends any[], R>(selector: string, pageFunction: PageFunctionOn<Element, Args, R>, ...args: Boxed<Args>) => Promise<R>;
|
||||
export type $$Eval = <Args extends any[], R>(selector: string, pageFunction: PageFunctionOn<Element[], Args, R>, ...args: Boxed<Args>) => Promise<R>;
|
||||
export type $Wait = <Args extends any[], R>(selector: string, pageFunction: PageFunctionOn<Element | undefined, Args, R>, options?: WaitForFunctionOptions, ...args: Boxed<Args>) => Promise<Handle<R>>;
|
||||
export type EvaluateOn<T> = <Args extends any[], R>(pageFunction: PageFunctionOn<T, Args, R>, ...args: Boxed<Args>) => Promise<R>;
|
||||
export type EvaluateHandleOn<T> = <Args extends any[], R>(pageFunction: PageFunctionOn<T, Args, R>, ...args: Boxed<Args>) => Promise<Handle<R>>;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user