ofetch icon indicating copy to clipboard operation
ofetch copied to clipboard

fix: types resolution when using typescript moduleResolution bundler

Open minht11 opened this issue 2 years ago โ€ข 1 comments

๐Ÿ”— Linked issue

โ“ Type of change

  • [ ] ๐Ÿ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • [x] ๐Ÿž 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.

minht11 avatar Nov 13 '23 00:11 minht11

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Nov 13 '23 02:11 codecov[bot]

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

1.3.4:

image

this PR:

image

pi0 avatar May 16 '24 10:05 pi0