Allow the use of types without using the DOM lib #6989
Closed
Description
Sometimes one wants to use puppeteer without using the DOM directly. I.e. in remark-mermaidjs I want to allow users to specify puppeteer launch options, but users of this library don’t have to interact with the DOM in any way. I’ve identified puppeteer uses the following types in `lib/types.d.ts:
Document
Element
NodeList
I believe these types can be stubbed in a similar way as I did here
/**
* This is a stub implementation to prevent the need to use dom types with puppeteer.
*
* To enable proper Element types, add `"dom"` to `"lib"` in your `tsconfig.json`.
*/
interface ElementStub {}
type Element = globalThis extends { window: any } ? Element : ElementStub
Metadata
Assignees
Labels
No labels