Skip to content

Missing types when using moduleResolution set to next, node16 or bundler #37

@ivancuric

Description

@ivancuric

If using TS with moduleResolution set to node16, nodenext or bundler, you get the following message:

Could not find a declaration file for module 'is-plain-object'. 'stackblitz:/node_modules/is-plain-object/dist/is-plain-object.mjs' implicitly has an 'any' type.
There are types at 'stackblitz:/node_modules/is-plain-object/is-plain-object.d.ts', but this result could not be resolved when respecting package.json "exports". The 'is-plain-object' library may need to update its package.json or typings.(7016)

Repro on Stackblitz: https://stackblitz.com/edit/vitejs-vite-caqzew?file=package.json,src%2Fmain.ts&terminal=dev

More info on why this happens can be found on arethetypeswrong/arethetypeswrong.github.io

Link to the type analysis and the output:

https://arethetypeswrong.github.io/?p=is-plain-object%405.0.0

Problems
No types

Import resolved to JavaScript files, but no type declarations were found.

  "is-plain-object" "is-plain-object/package.json"
node10 ✅ (JSON)
node16 (from CJS) ❌ No types ✅ (JSON)
node16 (from ESM) ❌ No types ✅ (JSON)
bundler ❌ No types ✅ (JSON)

Another package linter output:
https://publint.dev/is-plain-object@5.0.0

image

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