diff --git a/src/types.ts b/src/types.ts index 3cad1b4aebdb4..a9ad12b55bdce 100644 --- a/src/types.ts +++ b/src/types.ts @@ -18,7 +18,8 @@ import * as js from './javascript'; import * as dom from './dom'; import Injected from './injected/injected'; -type Boxed = { [Index in keyof Args]: Args[Index] | js.JSHandle }; +type BoxedArg = js.JSHandle | (Arg extends object ? { [Key in keyof Arg]: BoxedArg } : Arg); +type Boxed = { [Index in keyof Args]: BoxedArg }; type PageFunction = string | ((...args: Args) => R | Promise); type PageFunctionOn = string | ((on: On, ...args: Args) => R | Promise); type PageFunctionWithInjected = string | ((injected: Injected, on: On, ...args: Args) => R | Promise);