You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Almost everyone using modules these days is using a resolution format called node.
Even if you're not using Node.js - for example, bundlers such as Webpack and the like.
Eventually, Node.js added new resolution rules.
For example, the exports map.
Webpack also supports features like these.
When we added the node16, people thought "oh cool, now I can use the exports map".
Yes, with a bunch of new restrictions.
For example, explicit file extensions (e.g. everything must end in .js, .mjs, or .cts).
Arguably not the worst, but definitely confusing if you're authoring in .ts, .mts, or .cts.
But bundlers and the like don't adhere to those restrictions.
Devs using bundlers really didn't like that restriction!
What if we had something like node with some of the overlays that bundlers and the like support.
node mode accurately models a subset of them, and Node.js versions older than 12.
Can't support EVERY resolution mode out there. Maybe we can start with subsets and provide means to enable common features that are layered on top of them.
conventional/hybrid(?) - bundler modes
node16 - you use Node.js
minimal - something like what bundlers use, maybe custom/internal build
The logic that users don't like the Node.js restrictions so we should provide a mode that lets them take full advantage of their bundlers - is that good?
Is this just something people have to get over?
Zero bundlers enforce the same rules as Node.js.
That means that the community has sort of spoken.
Plus, people thinking "I'll write .ts" for my extension" is another big confusion point.
Look at what docs and boilerplates do today.
Could conventional have features layered on top to build up the node16 mode?
Have to think about the split between library authors and app developers.
Former probably want to use node16, latter should use conventional.
But there's nuance - not every library on npm is intended to be used on Node.js (e.g. web, React Native, etc.)
Contextually types an operand, makes sure the operand is assignable to the type.
Don't want to lose the type of a literal, but want to make sure it conforms to some shape.
Some nuance.
Thought
Was some concern around how satisfies plays with types as comments/type annotations proposal.
Isn't at conflict, per se - didn't want to give the appearance of "unstable" syntax.
We shouldn't stop TypeScript innovation based on it - type annotations can incorporate as we learn as well.
.ts can always be a superset of JS with types anyway.
So binary operator? No alternative?
as ~ T
as PLEasE
as satisfies
as satisfied by
<satisfies Foo>expr?
Type operator that can only be used in as assertions? (e.g. as (satisfies Foo))
The infix no-line-terminator space is the only place we are willing to trample, and we do it mindfully. In 27 years since JS has existed, nobody has needed satisfies for non-type purposes. There is a point where waiting speculatively in case that happens means you're just not shipping anything at all.
Drive for early in 4.9 release cycle, get feedback.
The text was updated successfully, but these errors were encountered:
Granular Resolutions
#50152
node
.exports
map.node16
, people thought "oh cool, now I can use theexports
map"..js
,.mjs
, or.cts
)..ts
,.mts
, or.cts
.node
with some of the overlays that bundlers and the like support.node
mode accurately models a subset of them, and Node.js versions older than 12.conventional
/hybrid
(?) - bundler modesnode16
- you use Node.jsminimal
- something like what bundlers use, maybe custom/internal build.ts
" for my extension" is another big confusion point.conventional
have features layered on top to build up thenode16
mode?node16
, latter should useconventional
.satisfies
Operator#47920
satisfies
plays with types as comments/type annotations proposal..ts
can always be a superset of JS with types anyway.as ~ T
as PLEasE
as satisfies
as satisfied by
<satisfies Foo>expr
?as
assertions? (e.g.as (satisfies Foo)
)satisfies
for non-type purposes. There is a point where waiting speculatively in case that happens means you're just not shipping anything at all.The text was updated successfully, but these errors were encountered: