sindresorhus / meow

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

typescript definitions stopped working #248

Closed chase-moskal closed 9 months ago

chase-moskal commented 9 months ago

hello! love the library!

i upgraded meow, and the typescript typings seem to have stopped working

i don't understand what's going wrong, since i can see at the unpkg browse link for meow@12.1.1 that the export field links to index.d.ts and index.js look correct to me :man_shrugging:

i'm on node v21.1.0 and typescript 5.2.2

in the meantime as a workaround i added a file called module-declarations.d.ts to my codebase with the following content, which worked to suppress the typescript error

declare module "meow"

hopefully this info helps, cheers :heart:

sindresorhus commented 9 months ago

Duplicate of #247

chase-moskal commented 9 months ago

thanks,

the solution was to set these settings in my tsconfig.json:

"module": "nodenext",
"moduleResolution": "nodenext",

this is required for meow, however it should be noted that you could also have dependencies that do not yet support nodenext, such as https://github.com/BabylonJS/Babylon.js/issues/13797 which was an issue i encountered in some of my projects