devtools-protocol
devtools-protocol copied to clipboard
Provide helper or instructions for using type definitions
I was glad to find type definitions for the protocol, but I don't see a way to use them with puppeteer's CDPSession.send.
Unless I'm missing something (which is entirely possible), it would be nice to have a simple helper that takes a (method: string, params?: object | undefined): Promise<any> function (as implemented by various libraries) and returns a type-checked wrapper.
See also GoogleChrome/puppeteer#2758
cc @brendankenny who did our implementation in lighthouse, though it's spread across a few files (connection.js, driver.js, protocol.d.ts)