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

Design Meeting Notes, 12/3/2024 #60707

Open
DanielRosenwasser opened this issue Dec 6, 2024 · 0 comments
Open

Design Meeting Notes, 12/3/2024 #60707

DanielRosenwasser opened this issue Dec 6, 2024 · 0 comments
Labels
Design Notes Notes from our design meetings

Comments

@DanielRosenwasser
Copy link
Member

New --module Targets for Node.js

#60589
#60534

  • Previously, we were pretty loose about JSON imports in nodenext.
    • We need to stop allowing named imports from these JSON files.
    • Also, Node.js requires you to use import attributes for JSON files.
  • In 5.7 we added fixes for cases when we resolve to JSON files.
  • We enabled this for node16 as well, but we error saying that you can only use import attributes in nodenext.
  • In Node.js 16, you can only use import assertions (the old deprecated thing), not import attributes.
    • We will probably make things loose again in node16 as well - no checks for JSON modules.
  • Node.js 16 is already EOL.
  • So where does this leave us?
    • Node.js 18 is still in maintenance, but does support import attributes.
    • Node 23 will have require(ESM) support.
  • Proposal:
    • --module nodenext allows require(ESM) (for Node.js 23/24, possibly 22)
      • Eventually settle on a specific line.
    • --module node20 depending on if the above features get back-ported.
    • --module node18 for import assertions and JSON import checks (what nodenext should be in TypeScript 5.7)
    • --module node16 to be deprecated farther down.
      • It is not the most ideal state (it is EOL, doesn't support JSON imports correctly), but TBD.
  • We like this plan, we feel okay to move forward with this for TypeScript 5.8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design Notes Notes from our design meetings
Projects
None yet
Development

No branches or pull requests

1 participant