Skip to content

'@whatwg-node/server/index.mjs' implicitly has an 'any' type. #574

@Tobbe

Description

@Tobbe

Describe the bug

I tried switching to moduleResolution: bundler in Redwood, but doing so I'm getting this TS error

Could not find a declaration file for module '@whatwg-node/server'. '/Users/tobbe/dev/redwood/redwood/node_modules/@whatwg-node/server/index.mjs' implicitly has an 'any' type.
There are types at '/Users/tobbe/dev/redwood/redwood/node_modules/@whatwg-node/server/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@whatwg-node/server' library may need to update its package.json or typings.

To Reproduce Steps to reproduce the behavior:

No sandbox link right now, sorry. Let me know if you want one

Expected behavior

No TS errors when using this package in an ESM environment

Environment:

  • OS: MacOS
  • package-name: @whatwg-node/server
  • NodeJS: 18

Additional context

In node_modules/@whatwg-node/server there is already an index.d.ts file. If I just copy/paste this file and name the copy index.d.mts the error goes away.

You can read more about the error here: microsoft/TypeScript#52363
That issue also links out to this PR with an example solution to that error in another project: gxmari007/vite-plugin-eslint#60 The comments on that PR are also good to read

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions