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

add typings to package.json export #1210

Merged
merged 1 commit into from
May 16, 2023
Merged

Conversation

cs4inctec
Copy link
Contributor

📝 Description

With TS 5.0 introducing "bundler" / "NodeNext" module resolution, importing types from moleculer will result in TS complaining that it can't resolve type declarations. TS seems to find the type declaration file but won't use it because it's not explicitly listed under "exports" in package.json.

See this issue for more details: microsoft/TypeScript#52363

Also relevant discussion here: gxmari007/vite-plugin-eslint#60 , which implies that this fix is better, but not really considered good. Unfortunately I couldn't get re-exporting types to work, and copy-ing index.d.ts and having to maintain 2 same files seems worse at the moment.

This PR just adds a "types" export line to the package.json, which seems to keep TS happy and resolve the error.

🎯 Relevant issues

💎 Type of change

  • Bug fix (non-breaking change which fixes an issue)

🚦 How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • packaged moleculer locally, and installed resulting package
  • npm run test

🏁 Checklist:

  • My code follows the style guidelines of this project
  • [ x I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have commented my code, particularly in hard-to-understand areas

@icebob icebob merged commit 1c49c36 into moleculerjs:master May 16, 2023
@icebob
Copy link
Member

icebob commented May 16, 2023

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants