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: re export ts enum type #325

Closed
wants to merge 4 commits into from
Closed

fix: re export ts enum type #325

wants to merge 4 commits into from

Conversation

tmg0
Copy link
Contributor

@tmg0 tmg0 commented Feb 6, 2024

πŸ”— Linked issue

Resolves #318

❓ 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

Added the declaration field in Import to distinguish between dts and enum When transfer exports to imports in toImport function findExports will tag enum as declaration, after dedupe imports, enum can only be used as a value.

Maybe add a type in mlly ESMExport is a better way? Or edit the return value after findExports instead of adding a field to the Export type?

Fix typescript enum auto import error, enum should be import as both value and type.

Resolves #318

πŸ“ Checklist

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

@antfu
Copy link
Member

antfu commented Feb 6, 2024

Yeah I think it makes sense to have mlly support that information later.

/cc @pi0 does the interface fields looks good to you?

@pi0
Copy link
Member

pi0 commented Feb 6, 2024

Generally yes! I would probably name it declarationType in interface btw or something that hints it is only a type indicator. And PR is more than welcome upstream I can release asap πŸ‘πŸΌ

Copy link

codecov bot commented Feb 16, 2024

Codecov Report

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

Comparison is base (da1733b) 98.73% compared to head (f154082) 98.74%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #325   +/-   ##
=======================================
  Coverage   98.73%   98.74%           
=======================================
  Files          14       14           
  Lines        1822     1834   +12     
  Branches      371      374    +3     
=======================================
+ Hits         1799     1811   +12     
  Misses         23       23           

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

@tmg0 tmg0 closed this Feb 22, 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.

Auto-import for enum is not working: TS2749: 'User' refers to a value, but is being used as a type
3 participants