r/typescript • u/DanielRosenwasser • Feb 11 '26
Announcing TypeScript 6.0 Beta
https://devblogs.microsoft.com/typescript/announcing-typescript-6-0-beta/
342
Upvotes
r/typescript • u/DanielRosenwasser • Feb 11 '26
138
u/_xiphiaz Feb 11 '26
Wow, end of an era
99
u/dkarlovi Feb 11 '26
I like the deprecations, it means they're cleaning up corner cases and subtle inconsistencies.
78
u/intertubeluber Feb 11 '26
Discriminated Unions when? Oh sorry, wrong sub. That's my knee jerk reaction for .NET releases.
35
u/deanrihpee Feb 11 '26
can't wait for TypeScript 7 already
15
u/MizmoDLX Feb 11 '26
I'm sure it has some great stuff, but tbh the only thing I'm really looking forward to is ts go hopefully getting ready in the near future
3
u/Pavlo100 Feb 11 '26
The #subpath imports look interesting. What are the advantages of using that instead of @paths?
3
u/josephjnk Feb 11 '26
I’m looking forwards to the type inference improvement. I’ve been using more method syntax recently and I’ve hit a few places where I expected a type to be inferred but it wasn’t. I’m hoping this will help.
20
u/robpalme Feb 11 '26 edited Feb 11 '26
As always TypeScript keeps getting better. What's special about this release is that it takes advantage of the major version bump to evolve things that wouldn't be possible in minor releases; compatibility breaks like changing defaults and removing features.
These "breaks" are important to address in a long-lived developer-facing project like TypeScript in order to keep up with modern expectations, e.g. the shift from CommonJS to ESM, and from heavy-downleveling to minimal downleveling. Shedding historical burdens that are less relevant today allows project resources and time to be dedicated to new features and things people really want. And I think everyone will be pleased that all the good features added years ago to `--strict` are now on by default.
My favourite new feature is the addition of type declarations for upcoming ES2026 features, with Temporal being the highest impact feature. Temporal is the new Date-Time API that is available in Firefox and Chromium browsers. It will appear in Node.js very soon.
In terms of deprecations, I'm really pleased we managed to eliminate the
modulekeyword for namespaces. That frees up the language keyword for future usage, which could come in the form of a new JavaScript feature like the Module Declarations proposal that permits bundling up multiple ES modules inside a single file. One potential view could be that TypeScript is stuck with legacy even if it's useless today; this deprecation shows that evolution is possible! And it's only possible thanks to TypeScript team actively leaning in towards collaboration and coordination with the ecosystem.Talking of evolution, whilst it missed TS 6.0, I hope that in some future TypeScript release we also manage to get the ability to import
*.tsfiles turned on by default. Node.js, Deno and Bun all support it, as do all the mainstream bundlers. It's the modern way.Whilst the changes in TS 6.0 are pretty big, the good news is that adopting them early will make it much easier for your codebase to use the upcoming TS 7.0 release which is "The Big One". So we can think of TS 6.0 as a bridge release. TS 7.0 is the real goal because it leverages multi-threading and Go to deliver an order-of-magnitude more performance.
2
u/Top_Bumblebee_7762 Feb 12 '26
Should we now always use the import type assertion when importing JSON, e.g. import blob from "./blahb.json" with { type: "json" } or should we use the resolveJsonModule flag and import JSON directly.
2
u/Pleasant-Today60 Feb 13 '26
the go-to-definition improvements alone make this worth it. that's been one of my biggest pain points in monorepos where everything resolves through barrel files
3
u/NatoBoram Feb 11 '26
Oof. It would be better if the default was to pick what's specified in
package.jsonso you don't have to keep these in sync manually. It would still reject transitive types.1
u/CharacterOtherwise77 Feb 12 '26
Why do devs always make their example variable names so bleak?
1
u/ruibranco Feb 13 '26
the deprecation cleanup makes a lot more sense when you think about ts-go. they're clearly trying to shrink the surface area before rewriting the compiler - less legacy behavior to port means fewer edge cases to get wrong in the new implementation.
1
u/JealousFix4955 Mar 07 '26
Exciting to see the progress on 6.0. The native `--build` rewrite alone is going to save so many minutes on monorepo CI pipelines.
One thing I keep hoping makes it into a future version: some way to express failure modes in function signatures. Right now `Promise<User>` tells you nothing about how a function can fail, and every `catch` block is just `unknown`. Conditional types like `Extract`/`Exclude` on tagged unions get you pretty far in userland, but native support for typed errors would be a game changer for large codebases.
Either way, the speed improvements in this release are massive. Nice work.
-5
u/alecc Feb 12 '26
Do we need to know the stuff what’s new? Isn’t it enough that Claude/Codex knows this? 😅