// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. type Boxed = { [Index in keyof Args]: Args[Index] | Handle }; type PageFunction = string | ((...args: Args) => R | Promise); type PageFunctionOn = string | ((on: On, ...args: Args) => R | Promise); export type Evaluate = (fn: PageFunction, ...args: Boxed) => Promise; export type EvaluateHandle = (fn: PageFunction, ...args: Boxed) => Promise; export type $Eval = (selector: string, fn: PageFunctionOn, ...args: Boxed) => Promise; export type $$Eval = (selector: string, fn: PageFunctionOn, ...args: Boxed) => Promise; export type EvaluateOn = (fn: PageFunctionOn, ...args: Boxed) => Promise; export type EvaluateHandleOn = (fn: PageFunctionOn, ...args: Boxed) => Promise; export interface EvaluationContext { evaluate: Evaluate; evaluateHandle: EvaluateHandle; } export interface Handle { dispose(): Promise; }