Skip to content

Conversation

@fisker
Copy link
Contributor

@fisker fisker commented Nov 25, 2024

PR Checklist

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.

Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this, but:

  • Would want to hear from @RebeccaStevens as they've been doing a bunch of fantastic work improving the build system (as you've seen)
  • If this is 👍, there should be a lint rule to stop new default imports from being added in the future

@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author Needs an action taken by the original poster label Nov 25, 2024
@codecov
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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.

☔ View full report in Codecov by Sentry.
📢 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.

@fisker
Copy link
Contributor Author

fisker commented Nov 25, 2024

Looks like it's a bad idea, the original package can't be namespace imported

> Object.keys(await import('typescript'))
[ 'default' ]

@fisker fisker closed this Nov 25, 2024
@fisker fisker deleted the typescript-namespace-import branch November 25, 2024 16:21
@fisker fisker restored the typescript-namespace-import branch March 19, 2025 05:33
@fisker
Copy link
Contributor Author

fisker commented Mar 19, 2025

Looks like typescript support namespace import now.

> Object.keys(await import('typescript')).length
2238

@fisker fisker reopened this Mar 19, 2025
@fisker fisker force-pushed the typescript-namespace-import branch from 865c19b to ea9702c Compare March 19, 2025 05:41
@RebeccaStevens
Copy link
Collaborator

Seems good to me. We just need to check that this is valid in all our supported versions of TypeScript

@JoshuaKGoldberg
Copy link
Owner

Filed #711 -> #712 on the versioning question. Agreed, I think we're blocked for now? ☹️

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft March 19, 2025 13:15
@RebeccaStevens RebeccaStevens added status: blocked Waiting for something else to be resolved 🙅 and removed status: waiting for author Needs an action taken by the original poster labels Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: blocked Waiting for something else to be resolved 🙅

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 Feature: Use namespace import from typescript, not default import

3 participants