From d5045976a6dd321bbd265b84c2474ff1ad5d0b77 Mon Sep 17 00:00:00 2001 From: jrandolf <101637635+jrandolf@users.noreply.github.com> Date: Mon, 19 Sep 2022 15:10:57 +0200 Subject: [PATCH] fix: internal lazy params (#8982) --- docs/api/puppeteer.innerparams.md | 2 +- src/common/IsolatedWorld.ts | 6 ++++-- src/common/types.ts | 9 ++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) 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; }; /**