Skip to content
TypeScript

TypeScript 5.9 Brings Import Defer and tsconfig Tweaks

TypeScript 5.9 introduces import defer, a refined tsc --init, and DOM API improvements, enhancing performance and developer experience.

Topic
TypeScript
Reading time
4 min
Length
938 words
Published
Aug 21, 2026
05:20 pm IST
In this article
  1. What's New in TypeScript 5.9?
  2. Minimal and Updated tsc --init
  3. Support for Import Defer
  4. Support for --module node20
  5. DOM API Improvements
  6. Optimizations and Notable Changes
  7. What I’d Do About This on Monday
  8. Limitations and Considerations

TypeScript 5.9 has just dropped, bringing some neat improvements to our development workflows and potentially boosting performance. The highlights? Support for import defer, a tweaked tsc --init command, and various enhancements to DOM APIs. Let’s dig into these changes and see how they might shake up your codebase.

What's New in TypeScript 5.9?

This version of TypeScript aims to give developers more control and enhance efficiency. Some key changes include:

  • Streamlined tsc --init generation
  • Import defer support
  • --module node20 option
  • DOM API summary descriptions
  • Customizable hover features
  • Enhanced performance

Minimal and Updated tsc --init

The tsc --init command used to spit out a long tsconfig.json with lots of commented-out settings. Now, with TypeScript 5.9, the command is more streamlined to fit modern developer habits. It sets sensible defaults like using modules, targeting the up-to-date ECMAScript features, and enabling JSX for React. This revamp means less hassle with setup and shifts the focus to what's practical today.

Here’s what’s new: the module option defaults to nodenext, which works well for most projects using the latest JavaScript modules. It also sets the target to esnext, allowing you to harness the latest ECMAScript goodies. To keep things light, types is left as an empty array, cutting down unnecessary type declarations and easing the load on the compiler. What I also like, stricter type-checking options like noUncheckedIndexedAccess and exactOptionalPropertyTypes are enabled to catch issues before they snowball.

{
  "compilerOptions": {
    "module": "nodenext",
    "target": "esnext",
    "types": [],
    "sourceMap": true,
    "declaration": true,
    "declarationMap": true,
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,
    "strict": true,
    "jsx": "react-jsx",
    "verbatimModuleSyntax": true,
    "isolatedModules": true,
    "noUncheckedSideEffectImports": true,
    "moduleDetection": "force",
    "skipLibCheck": true
  }
}

These choices aim to make starting new projects a breeze. For me, sticking to these defaults usually pays off by saving me time and nipping errors in the bud.

Support for Import Defer

The new import defer syntax in TypeScript 5.9 lets you bring in modules without firing them up immediately. It gives you control over when a module and its side-effects kick in, which is handy for loading expensive or platform-specific modules only when necessary. The catch? It’s about the namespace imports:

import defer * as feature from "./some-feature.js";

Delaying module evaluation until it's necessary can really help with startup speed, especially in hefty applications. But bear in mind, import defer doesn’t transform in TypeScript and needs a runtime that supports it out of the box. It’ll only work in --module modes preserve and esnext. So, your module must be fully accessible, either from the file system or online.

Using import defer might be incredibly useful in cases where some modules have heavy-duty initializations that you don't need right away. It can seriously boost performance in big, complex applications.

Support for --module node20

Introducing the --module node20 option, aimed at matching Node.js v20 behavior. This brings you stable, unchanging behavior by setting --target to es2023 by default. It’s all about staying aligned with Node.js and making your code more predictable.

--module node20 provides a stable environment unlike --module nodenext, which floats with the latest --target esnext. This is a lifesaver if you need your code to play nice with specific Node.js versions and quirks.

DOM API Improvements

TypeScript has stepped up its game by weaving in summary descriptions from MDN documentation into DOM APIs. No more detours to external docs—these summaries right in your editor can speed up your workflow and understanding. It's a simple change, but a good one for keeping productivity high without missing a beat.

Optimizations and Notable Changes

With TypeScript 5.9, performance tweaks tackle things like type instantiation depth in complex libraries such as Zod and tRPC. By caching intermediate steps, the compiler skips unnecessary grunt work, which means better performance. However, changes in lib.d.ts might affect type-checking, especially for ArrayBuffer and TypedArray. Watch out for these and tweak your code to keep things smooth.

What I’d Do About This on Monday

For those handling a production codebase, here’s my two cents:

  • Update to TypeScript 5.9 with npm install -D typescript and enjoy the new features.
  • Review your tsconfig.json and maybe simplify it with the new default settings from tsc --init. It cuts down on config bloat and aligns your project with current standards.
  • Think about using import defer for modules that don’t need to be initialized right away. This could boost your app's startup speed.
  • If you bump into type-checking issues with Buffer types, make sure you’ve got the latest @types/node package and adjust your code to use specific buffer types as needed.

After upgrading to TypeScript 5.9, test your app thoroughly to make sure everything gels well with your existing codebase. Be on the lookout for any hiccups or bug reports from others; these can be gold mines for insights and adjustments.

Limitations and Considerations

While TypeScript 5.9 packs a punch with new features, it’s worth keeping some limitations in mind. The import defer will only fly in environments that naturally support it or with tools that have its back. Changes in type inference might stir up new errors, meaning you might need to specify type arguments more than before.

These updates will likely resonate with folks dealing with large TypeScript projects or those deeply tied to Node.js. But if your current setup with an older TypeScript version is humming along nicely, you might wait for more pressing reasons to upgrade.

While the refreshed tsconfig.json defaults offer simplifications, they might not fit every project like a glove. Carefully review them and tweak as needed to mesh with your project’s unique needs. In my book, customizing these settings can lead to code that’s not only easier to manage but stands the test of time.

Sources

Announcing TypeScript 5.9

Every claim above was checked against this source before publishing. The analysis, the code and the opinions are mine.

Frequently asked

What is the purpose of import defer in TypeScript 5.9?

Import defer allows importing a module without immediately executing it, providing control over when its side-effects occur, beneficial for performance.

How does TypeScript 5.9 improve tsconfig.json initialization?

The <code>tsc --init</code> command now generates a minimal tsconfig.json that aligns with modern development practices, reducing configuration overhead.

Are there any changes in DOM API handling in TypeScript 5.9?

Yes, TypeScript 5.9 includes summary descriptions for many DOM APIs based on MDN documentation, improving developer understanding and productivity.

Deepak Kumar

Written by

Deepak Kumar

Sr Software Engineer at India Today Group | Aaj Tak · MERN Stack · Generative AI

I build production web applications and Generative AI systems — React and Next.js on the front, Node.js and RAG pipelines behind them. I write here about what those systems actually do once real traffic hits them.

Message me