/** * @license * Copyright 2020 Google Inc. * SPDX-License-Identifier: Apache-2.0 */ import type {ParseSelector} from 'typed-query-selector/parser.js'; import type {ElementHandle} from '../api/ElementHandle.js'; import type {JSHandle} from '../api/JSHandle.js'; import type {LazyArg} from './LazyArg.js'; /** * @public */ export type AwaitablePredicate = (value: T) => Awaitable; /** * @public */ export interface Moveable { /** * Moves the resource when 'using'. */ move(): this; } /** * @internal */ export interface Disposed { get disposed(): boolean; } /** * @internal */ export interface BindingPayload { type: string; name: string; seq: number; args: unknown[]; /** * Determines whether the arguments of the payload are trivial. */ isTrivial: boolean; } /** * @internal */ export type AwaitableIterator = Iterator | AsyncIterator; /** * @public */ export type AwaitableIterable = Iterable | AsyncIterable; /** * @public */ export type Awaitable = T | PromiseLike; /** * @public */ export type HandleFor = T extends Node ? ElementHandle : JSHandle; /** * @public */ export type HandleOr = HandleFor | JSHandle | T; /** * @public */ export type FlattenHandle = T extends HandleOr ? U : never; /** * @internal */ 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; }; /** * @public */ export type ElementFor< TagName extends keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap, > = TagName extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[TagName] : TagName extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[TagName] : never; /** * @public */ export type EvaluateFunc = ( ...params: InnerParams ) => Awaitable; /** * @public */ export type EvaluateFuncWith = ( ...params: [V, ...InnerParams] ) => Awaitable; /** * @public */ export type NodeFor = ParseSelector;