diff --git a/docs/api/puppeteer.innerparams.md b/docs/api/puppeteer.innerparams.md index 1cb93ea68fe..8518b00eaa3 100644 --- a/docs/api/puppeteer.innerparams.md +++ b/docs/api/puppeteer.innerparams.md @@ -8,7 +8,7 @@ sidebar_label: InnerParams ```typescript export declare type InnerParams = { - [K in keyof T]: FlattenHandle>>; + [K in keyof T]: FlattenHandle; }; ``` diff --git a/src/common/IsolatedWorld.ts b/src/common/IsolatedWorld.ts index 04dba2e82ee..c19759cc7bf 100644 --- a/src/common/IsolatedWorld.ts +++ b/src/common/IsolatedWorld.ts @@ -30,7 +30,7 @@ import {JSHandle} from './JSHandle.js'; import {LazyArg} from './LazyArg.js'; import {LifecycleWatcher, PuppeteerLifeCycleEvent} from './LifecycleWatcher.js'; import {TimeoutSettings} from './TimeoutSettings.js'; -import {EvaluateFunc, HandleFor, NodeFor} from './types.js'; +import {EvaluateFunc, HandleFor, InnerLazyParams, NodeFor} from './types.js'; import {createJSHandle, debugError, pageBindingInitString} from './util.js'; import {TaskManager, WaitTask} from './WaitTask.js'; @@ -559,7 +559,9 @@ export class IsolatedWorld { waitForFunction< Params extends unknown[], - Func extends EvaluateFunc = EvaluateFunc + Func extends EvaluateFunc> = EvaluateFunc< + InnerLazyParams + > >( pageFunction: Func | string, options: { diff --git a/src/common/types.ts b/src/common/types.ts index 42f984e18f0..e293886272f 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -43,11 +43,18 @@ export type FlattenHandle = T extends HandleOr ? U : never; */ export type FlattenLazyArg = T extends LazyArg ? U : T; +/** + * @internal + */ +export type InnerLazyParams = { + [K in keyof T]: FlattenLazyArg; +}; + /** * @public */ export type InnerParams = { - [K in keyof T]: FlattenHandle>>; + [K in keyof T]: FlattenHandle; }; /**