TypeScript 5.9 creates leaner tsconfig.json files

The new TypeScript version reduces the tsconfig.json files to the essentials and supports deferring module evaluation and fold-out hover info.

listen Print view
Typewriter with Typescript lettering

(Image: erstellt mit KI durch iX)

3 min. read
Contents

Microsoft has released version 5.9 of its TypeScript programming language. It includes some new features, such as streamlined and updated tsconfig.json via --init flag. Under the hood, the TypeScript team is still working on implementing the native port to Go, but this is not included in the current release.

The TypeScript compiler can create a tsconfig.json file within the current project directory using the --init flag. However, as the TypeScript team explains, this file has grown so much over the last few years that most developers delete most of its content directly. This included numerous commented-out settings, including descriptions.

The file has therefore now been streamlined and should be better tailored to current user needs. Among other things, it contains the setting that --target is set to esnext (ESNext, the next version of the ECMAScript standard).

In TypeScript 5.9, a tsconfig.json generated with tsc --init – without using additional flags – looks like this:

{
  // Visit https://aka.ms/tsconfig to read more about this file
  "compilerOptions": {
    // File Layout
    // "rootDir": "./src",
    // "outDir": "./dist",

    // Environment Settings
    // See also https://aka.ms/tsconfig_modules
    "module": "nodenext",
    "target": "esnext",
    "types": [],
    // For nodejs:
    // "lib": ["esnext"],
    // "types": ["node"],
    // and npm install -D @types/node

    // Other Outputs
    "sourceMap": true,
    "declaration": true,
    "declarationMap": true,

    // Stricter Typechecking Options
    "noUncheckedIndexedAccess": true,
    "exactOptionalPropertyTypes": true,

    // Style Options
    // "noImplicitReturns": true,
    // "noImplicitOverride": true,
    // "noUnusedLocals": true,
    // "noUnusedParameters": true,
    // "noFallthroughCasesInSwitch": true,
    // "noPropertyAccessFromIndexSignature": true,

    // Recommended Options
    "strict": true,
    "jsx": "react-jsx",
    "verbatimModuleSyntax": true,
    "isolatedModules": true,
    "noUncheckedSideEffectImports": true,
    "moduleDetection": "force",
    "skipLibCheck": true,
  }
}

TypeScript 5.9 also brings support for the ECMAScript proposal Deferring Module Evaluation through the new syntax import defer. It allows a module to be imported without immediately executing it and its dependencies. This should give developers more control. The proposal is currently at the penultimate stage of completion, “Stage 3 (Candidate).”

In addition to further updates, there is also a preview feature on board: expandable hovers. In Visual Studio Code, information about the TypeScript code appears when developers hover over it with the mouse. This information can now be expanded to show further details. The new function is called Expandable Hovers or Quick Info Verbosity.

Developers can now set how detailed the information appears when hovering over TypeScript code in VS Code.

(Image: Microsoft Developer Blog)

The development of the new feature in collaboration with the VS Code team can be followed on GitHub: There are corresponding pull requests in the TypeScript repo and in the VS Code repo.

Microsoft's developer blog provides further information on the updates in TypeScript 5.9.

The porting of the TypeScript compiler and other components to the Go programming language started at the beginning of this year and should allow the compiler to be up to ten times faster. The native Go implementation should be completed in TypeScript 7.0 – but TypeScript 6.0 will be released first. This version is intended to serve as a turning point for developers to get their code bases ready for TypeScript 7.0.

Although new features and updates may be included in the next release, the focus will clearly be on preparing for version 7.0, explains the TypeScript team. It assumes that most projects can be updated to version 6.0 –, which should be fully API-compatible with TypeScript 5.9 –, without any major hurdles.

New information on TypeScript 7.0 will follow soon. In the form of native previews, a preview can already be tested in Visual Studio Code and installed in projects.

(mai)

Don't miss any news – follow us on Facebook, LinkedIn or Mastodon.

This article was originally published in German. It was translated with technical assistance and editorially reviewed before publication.