Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript definitions stopped working #248

Closed
Tracked by #36
chase-moskal opened this issue Nov 4, 2023 · 2 comments
Closed
Tracked by #36

typescript definitions stopped working #248

chase-moskal opened this issue Nov 4, 2023 · 2 comments

Comments

@chase-moskal
Copy link

hello! love the library!

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

  • [email protected] all good
    • this version of the package has this exports field:
      "exports": {
          "types": "./index.d.ts",
          "default": "./source/index.js"
      },
  • [email protected] gives me a typescript error:
    • TS2307: Cannot find module 'meow' or its corresponding type declarations.
    • the error points at this line:
      import meow from "meow"
    • this version of the package has this exports field:
      "exports": {
          "types": "./build/index.d.ts",
          "default": "./build/index.js"
      },

i don't understand what's going wrong, since i can see at the unpkg browse link for [email protected] that the export field links to index.d.ts and index.js look correct to me 🤷‍♂️

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 ❤️

@sindresorhus
Copy link
Owner

Duplicate of #247

@sindresorhus sindresorhus marked this as a duplicate of #247 Nov 4, 2023
@sindresorhus sindresorhus closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2023
@chase-moskal
Copy link
Author

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 BabylonJS/Babylon.js#13797 which was an issue i encountered in some of my projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants