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
⚠️ Check Your Code
If you use any of these symbols, you need to read this guide:
erasableSyntaxOnlymodulemoduleResolutionimportrequireBreaking 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
- 1Update 'assert' keywords in import statements to 'with'.
- 2Ensure that no code precedes 'use strict' directives in files intended to be emitted as modules.
- 3If 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