fix: internal lazy params (#8982)

This commit is contained in:
jrandolf 2022-09-19 15:10:57 +02:00 committed by GitHub
parent 7d6927209e
commit d5045976a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View File

@ -8,7 +8,7 @@ sidebar_label: InnerParams
```typescript ```typescript
export declare type InnerParams<T extends unknown[]> = { export declare type InnerParams<T extends unknown[]> = {
[K in keyof T]: FlattenHandle<FlattenLazyArg<FlattenHandle<T[K]>>>; [K in keyof T]: FlattenHandle<T[K]>;
}; };
``` ```

View File

@ -30,7 +30,7 @@ import {JSHandle} from './JSHandle.js';
import {LazyArg} from './LazyArg.js'; import {LazyArg} from './LazyArg.js';
import {LifecycleWatcher, PuppeteerLifeCycleEvent} from './LifecycleWatcher.js'; import {LifecycleWatcher, PuppeteerLifeCycleEvent} from './LifecycleWatcher.js';
import {TimeoutSettings} from './TimeoutSettings.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 {createJSHandle, debugError, pageBindingInitString} from './util.js';
import {TaskManager, WaitTask} from './WaitTask.js'; import {TaskManager, WaitTask} from './WaitTask.js';
@ -559,7 +559,9 @@ export class IsolatedWorld {
waitForFunction< waitForFunction<
Params extends unknown[], Params extends unknown[],
Func extends EvaluateFunc<Params> = EvaluateFunc<Params> Func extends EvaluateFunc<InnerLazyParams<Params>> = EvaluateFunc<
InnerLazyParams<Params>
>
>( >(
pageFunction: Func | string, pageFunction: Func | string,
options: { options: {

View File

@ -43,11 +43,18 @@ export type FlattenHandle<T> = T extends HandleOr<infer U> ? U : never;
*/ */
export type FlattenLazyArg<T> = T extends LazyArg<infer U> ? U : T; export type FlattenLazyArg<T> = T extends LazyArg<infer U> ? U : T;
/**
* @internal
*/
export type InnerLazyParams<T extends unknown[]> = {
[K in keyof T]: FlattenLazyArg<T[K]>;
};
/** /**
* @public * @public
*/ */
export type InnerParams<T extends unknown[]> = { export type InnerParams<T extends unknown[]> = {
[K in keyof T]: FlattenHandle<FlattenLazyArg<FlattenHandle<T[K]>>>; [K in keyof T]: FlattenHandle<T[K]>;
}; };
/** /**