r/javascript • TypeScript • Mar 01 '23

Announcing TypeScript 5.0 RC

https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-rc

[removed] — view removed post

69 Upvotes

7 comments sorted by

59

u/robpalme Mar 01 '23

There's a LOT to be happy about in this release but I will mention only one feature.

IMO Andrew Branch's work on --moduleResolution bundler may be the most impactful here in terms of propelling ESM adoption across the ecosystem.

Up until now, some people were put off using ESM in Node because they were forced to specify the file extension in import statements. Whereas in TypeScript 5.0 the new resolution mode allows the file extension to be omitted because TypeScript can delegate to the bundler to ensure runtime resolution works.

This may seem like a trivial/aesthetic choice, but regardless it is a deal-breaker for some folk. So I'm glad TypeScript 5.0 introduces choice and unlocks the next incremental wave of migration to use standard ES modules.

6

u/Ok_Specialist_5748 Mar 02 '23

100% agree! This is HUGE! Thank you Andrew!

5

u/WhiplashClarinet Mar 02 '23

I want .ts imports without a bundler though 😢

3

u/[deleted] Mar 02 '23

Use bun.sh

5

u/[deleted] Mar 02 '23

lol that sounds like a super lame deal breaker, but glad it's fixed for folks :)

13

u/[deleted] Mar 02 '23 edited Mar 03 '23

The dealbreaker wasn’t so much that people were forced to specify the file extension, but that they were forced to specify the wrong file extension. Rather than specifying a .ts extension like their source files, they had to use .js despite no file existing with such extension. This in turn also caused issues for other tools.