Open lucadalli opened 2 weeks ago
Is this some horrendous TypeScript change? If types are not specified by an export, it's supposed to look in the global types specification. This nonsense about "can't use that while respecting exports" is utterly bizarre; no one should have to respecify the types file in the exports when it's already specified globally. I use the variant packages with many TypeScript projects and none of them complain in this way.
Unfortunately I have never properly authored a public-facing package so I'm not so well-versed about the proper way to define a package.json
. What you're saying makes sense to me but that error does explicitly state that it found the types by using the main types
field but could not respect it because it's missing from exports.types
.
I am seeing this error in VSCode only when I enable strict: true
in the tsconfig.json
compilerOptions
as per the minimal repro.
Is strict
enabled in any of your Typescript projects?
Yes. What I've never seen before is moduleResolution "Bundler". I have no idea what that means. The normal module resolution is "node" (or "nodenext" or "node6" etc etc etc)
I am facing the error above when importing
libav.js
or any of the variant packages into my Nuxt project. I am very ignorant about bundlers and their configuration but have prepared a minimal repro at lucadalli/libav-types-errorOne way to fix the error is to add a types field to
package.json
exports
and importing the types like so: