devtools-protocol icon indicating copy to clipboard operation
devtools-protocol copied to clipboard

Provide helper or instructions for using type definitions

Open FiloSottile opened this issue 7 years ago • 1 comments

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

FiloSottile avatar Jun 17 '18 19:06 FiloSottile

cc @brendankenny who did our implementation in lighthouse, though it's spread across a few files (connection.js, driver.js, protocol.d.ts)

paulirish avatar Jun 18 '18 17:06 paulirish