/** * Copyright (c) Microsoft Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { JSHandle, ElementHandle, Frame, Page, BrowserContext } from './types'; /** * Can be converted to JSON */ export type Serializable = any; /** * Can be converted to JSON, but may also contain JSHandles. */ export type EvaluationArgument = {}; export type NoHandles = Arg extends JSHandle ? never : (Arg extends object ? { [Key in keyof Arg]: NoHandles } : Arg); export type Unboxed = Arg extends ElementHandle ? T : Arg extends JSHandle ? T : Arg extends NoHandles ? Arg : Arg extends [infer A0] ? [Unboxed] : Arg extends [infer A0, infer A1] ? [Unboxed, Unboxed] : Arg extends [infer A0, infer A1, infer A2] ? [Unboxed, Unboxed, Unboxed] : Arg extends [infer A0, infer A1, infer A2, infer A3] ? [Unboxed, Unboxed, Unboxed, Unboxed] : Arg extends Array ? Array> : Arg extends object ? { [Key in keyof Arg]: Unboxed } : Arg; export type PageFunction0 = string | (() => R | Promise); export type PageFunction = string | ((arg: Unboxed) => R | Promise); export type PageFunctionOn = string | ((on: On, arg2: Unboxed) => R | Promise); export type SmartHandle = [T] extends [Node] ? ElementHandle : JSHandle; export type ElementHandleForTag = ElementHandle; export type BindingSource = { context: BrowserContext, page: Page, frame: Frame };