WebReflection / linkedom

A triple-linked lists based DOM implementation.
https://webreflection.medium.com/linkedom-a-jsdom-alternative-53dd8f699311
ISC License
1.66k stars 80 forks source link

Proper types exports for `./worker` submodule #271

Closed fineshop closed 4 months ago

fineshop commented 4 months ago

Hey, the linkedom/workers submodule types does not work when moduleResolution is set to Bundler. The following error occurs:

Could not find a declaration file for module 'linkedom/worker'. '**/node_modules/linkedom/worker.js' implicitly has an 'any' type.
  There are types at '**/node_modules/linkedom/types/esm/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'linkedom' library may need to update its package.json or typings.

It can be fixed by making changes to ./worker exports as shown below:

{
  "exports": {
    // ...
    "./worker": {
      "types": "./types/esm/index.d.ts",
      "import": "./worker.js"
    }
    // ...
  }
}
WebReflection commented 4 months ago

PR welcome