refactor: use namespace import to import "typescript"
PR Checklist
- [x] Addresses an existing open issue: fixes #711
- [ ] That issue was marked as
status: accepting prs - [ ] Steps in CONTRIBUTING.md were taken
Overview
In build script of Prettier, we transform the typescript package to ESM for better tree-shake, then we rewrite "import"s
from ts-api-utils, do you think it's acceptable to use namespace import here? so we don't need rewrite these "import"s.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 77.08%. Comparing base (
39e06e3) to head (ea9702c). Report is 2 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #588 +/- ##
=======================================
Coverage 77.08% 77.08%
=======================================
Files 50 50
Lines 5009 5009
Branches 688 688
=======================================
Hits 3861 3861
Misses 1147 1147
Partials 1 1
| Flag | Coverage Δ | |
|---|---|---|
| 4.8.4 | 74.44% <100.00%> (ø) |
|
| latest | 76.66% <100.00%> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Looks like it's a bad idea, the original package can't be namespace imported
> Object.keys(await import('typescript'))
[ 'default' ]
Looks like typescript support namespace import now.
> Object.keys(await import('typescript')).length
2238
Seems good to me. We just need to check that this is valid in all our supported versions of TypeScript
Filed #711 -> #712 on the versioning question. Agreed, I think we're blocked for now? ☹️