Skip to content

Commit

Permalink
feat(types): better types for nested handles (#1424)
Browse files Browse the repository at this point in the history
References #1348.
  • Loading branch information
dgozman authored Mar 18, 2020
1 parent bfcffbb commit a1929e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import * as js from './javascript';
import * as dom from './dom';
import Injected from './injected/injected';

type Boxed<Args extends any[]> = { [Index in keyof Args]: Args[Index] | js.JSHandle<Args[Index]> };
type BoxedArg<Arg> = js.JSHandle<Arg> | (Arg extends object ? { [Key in keyof Arg]: BoxedArg<Arg[Key]> } : Arg);
type Boxed<Args extends any[]> = { [Index in keyof Args]: BoxedArg<Args[Index]> };
type PageFunction<Args extends any[], R = any> = string | ((...args: Args) => R | Promise<R>);
type PageFunctionOn<On, Args extends any[], R = any> = string | ((on: On, ...args: Args) => R | Promise<R>);
type PageFunctionWithInjected<On, Args extends any[], R = any> = string | ((injected: Injected, on: On, ...args: Args) => R | Promise<R>);
Expand Down

0 comments on commit a1929e2

Please sign in to comment.