Change8

Migrating to TypeScript v5.8.2

Version v5.8.2 introduces 3 breaking changes. This guide details how to update your code.

Released: 2/28/2025

3
Breaking Changes
3
Migration Steps
5
Affected Symbols

⚠️ Check Your Code

If you use any of these symbols, you need to read this guide:

erasableSyntaxOnlymodulemoduleResolutionimportrequire

Breaking Changes

Issue #1

Granular checks for 'use strict' in files: TypeScript now strictly enforces that certain prologue-disallowed constructs (like octal literals) cannot exist before 'use strict' in ESM files.

Issue #2

Restrictions on Import Assertions: The deprecated 'assert' syntax for import attributes now triggers a warning/error in favor of 'with'.

Issue #3

Stricter return type inference for conditional expressions may catch previously unflagged type mismatches.

Migration Steps

  1. 1
    Update 'assert' keywords in import statements to 'with'.
  2. 2
    Ensure that no code precedes 'use strict' directives in files intended to be emitted as modules.
  3. 3
    If using simple transpilers, consider enabling the 'erasableSyntaxOnly' flag to catch incompatible syntax early.

Release Summary

TypeScript 5.8 introduces the 'erasableSyntaxOnly' flag, support for 'require()' of ESM in Node.js, and stricter checks for 'use strict' prologues. It focuses on performance optimizations and better compatibility with modern JavaScript runtimes.

Need More Details?

View the full release notes and all changes for TypeScript v5.8.2.

View Full Changelog