-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Design NotesNotes from our design meetingsNotes from our design meetings
Description
Reusing Type Nodes from Assertion Expressions
Set impliedNodeFormat
in Every Module Mode
- Expanded traversal with
mdast-util-to-string
exports a namedtoString
binding.-
However in
moduleResolution: esnext
and others, we permit a default import of the module.import mdast from "mdast-util-to-string"; mdast.toString; // TypeScript INCORRECTLY allows this.
-
- We don't under
nodenext
etc.- Because we actually track this information.
- Idea is to consider this information in all module modes.
- Under an older mode like
commonjs
/node10
, we look for high-confidence indicators (e.g.mts
files,package.json
information). - Avoids issues where people have an unchecked
.cjs
file withmodule.exports
incorrectly transformed to include anexport {}
at the end of the file. - We can't do perfectly, but we can catch a certain class of errors!
- Doing
package.json
resolution in all modes slows things down slightly, but we might be able to optimize more.
Proactively Ship esXXXX
Emit Targets
- Some editions of the language will have no changes, or people want to just speculate and say "whatever is stable for this upcoming year.
- Expectation among users
- But there's a royalty-free opt-out period where features can be removed from an edition.
- Well...this has never happened.
- How is this possibly not at odds with the stage 3 "start implementing and possibly ship" indicator?
- Seems reasonable to place a schedule for the target versions and
lib
s - Regardless of whether there are any actual changes, it feels like adding a new "no-op" year isn't a problem.
- Creating a version specifically seems like it's not a problem?
- What is the strategy? Saying
es2024
is an alias fores2023
means that whenes2024
gets solidified, syntax stops getting transformed. That's a break. - Saying it's an alias for
esnext
is less breaky - but a feature can be stalled in stage 3 for a long time.- But there is a break! If TS is not able to downlevel a feature and then says "oops, we can't downlevel this for es2024".
- What is the strategy? Saying
- Conclusion: start establishing new
esXXXX
targets following ratification in the standards body. Typically the 2nd plenary meeting of the year.
Metadata
Metadata
Assignees
Labels
Design NotesNotes from our design meetingsNotes from our design meetings