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

fix: types resolution when using typescript moduleResolution bundler #320

Closed
wants to merge 2 commits into from

Conversation

minht11
Copy link

@minht11 minht11 commented Nov 13, 2023

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

New Typescript bundler resolution algorith picks first matched option, if types are at the end it is likely other option will be matched first and error will be shown Cannot find module 'ofetch' or its corresponding type declarations.ts(2307) pnpm

More context as for why can be found here by core Typescript maintainer here.

TLDR. Put types field first.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

codecov bot commented Nov 13, 2023

Codecov Report

All modified and coverable lines are covered by tests βœ…

Project coverage is 69.67%. Comparing base (27996d3) to head (f087bf8).
Report is 17 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #320       +/-   ##
===========================================
+ Coverage   56.86%   69.67%   +12.80%     
===========================================
  Files          16       15        -1     
  Lines         728      610      -118     
  Branches      113      115        +2     
===========================================
+ Hits          414      425       +11     
+ Misses        303      175      -128     
+ Partials       11       10        -1     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@pi0
Copy link
Member

pi0 commented May 16, 2024

Thanks for PR. Testing on https://arethetypeswrong.github.io/

1.3.4:

image

this PR:

image

@pi0 pi0 closed this May 16, 2024
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

Successfully merging this pull request may close these issues.

2 participants