sindresorhus / meow

🐈 CLI app helper
MIT License
3.53k stars 150 forks source link

Add "types" field in package.json #247

Closed imballinst closed 10 months ago

imballinst commented 11 months ago

Hello, thanks for creating this awesome package, really appreciate it!

So I've been playing with this package recently, and I noticed that I when importing meow, I had this error:

Cannot find module 'meow' or its corresponding type declarations.ts(2307)

Repro can be seen here: https://codesandbox.io/p/sandbox/nervous-silence-gdmsnv?file=%2Fsrc%2Findex.ts%3A11%2C1. Curiously, if I add "types": "./build/index.d.ts" in the node_modules directly, the error will be gone.

Is there something that I might be missing here? Thanks!

EDIT: this is the example if I "patch" the package.json directly: https://codesandbox.io/p/sandbox/zealous-jerry-z3cwml?file=%2Fsrc%2Findex.ts%3A2%2C22, notice that there is no red line under the "meow" import.

sindresorhus commented 10 months ago

https://github.com/sindresorhus/meow/pull/246

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

imballinst commented 10 months ago

oh wow, using moduleResolution: "node16" actually works! Apologies, I missed (or forgot) that part of the guide. Thanks for the references @sindresorhus!