Hey, TypeScript fans, rejoice—TypeScript 5.9 is officially out! Packed with smart enhancements, this release is all about improving performance, easing setup, and boosting developer productivity. Let’s walk through the highlights.
1. More Thoughtful Defaults with tsc –init
Goodbye, bloated config files. Now, tsc –init creates a streamlined tsconfig.json with smart defaults like module: “nodenext” and target: “esnext”. Stricter type checks (noUncheckedIndexedAccess, exactOptionalPropertyTypes) are already turned on, so you get safer code from the get-go without extra tweaks.
2. Smarter Imports with import defer
Introducing import defer—a cool new way to load modules only when you need them. Instead of executing everything in your app upfront, this tells TypeScript and your runtime to wait until the module’s properties are actually accessed. Perfect for delaying costly initialization and speeding up app startup.
3. Stable Node.js Compatibility with –module node20
TypeScript 5.9 adds a new –module node20 option to lock in compatibility with Node.js v20 behavior. Unlike the ever-evolving nodenext, this one’s rock-solid, implying target: es2023 for dependable builds across teams.
4. Smarter Hovers in Your Editor — Now Expandable!
Hovering over types will be much cooler now—in VS Code, you’ll see + and – buttons within tooltips. That lets you dive into deeper type information right in place, without disrupting your flow. Even better, those pop-ups can be longer by default (or configurable), so you’re less likely to miss key type details.
5. Behind-the-Scenes Performance Boosts
Your builds just got peppier. TypeScript now caches instantiations of repeated types, reducing redundant work in big libraries like Zod and tRPC. There’s also a micro-optimization that speeds up file existence checks by cutting out unnecessary function closures—saving about 11% build time in some cases.
TL;DR – Why You’ll Love 5.9
Feature | Benefit |
tsc –init makeover | Leaner, smarter initial setup |
import defer | Lazily load modules for faster start |
–module node20 | Solid, predictable Node.js behavior |
Expandable Hover Tooltips | Deeper insights, fewer context shifts |
Performance optimizations | Faster builds, smoother dev experience |
In short: TypeScript 5.9 is a thoughtful release that smooths out your setup, upgrades your code introspection, and trims performance bottlenecks. Definitely worth trying today!