Migrating to TypeScript v5.8-rc
Version v5.8-rc introduces 2 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:
--module--erasableSyntaxOnlyimportrequireassertwithBreaking Changes
●Issue #1
Restrictions on Import Assertions: The legacy 'assert' syntax for import attributes now triggers an error when used with 'type: module' in Node.js. Use the 'with' keyword instead.
●Issue #2
Stricter checks for 'use strict' in modules: TypeScript now correctly identifies that modules are always in strict mode, which may surface new errors in code that previously relied on non-strict behavior.
Migration Steps
- 1Update import attribute syntax from 'assert { type: "json" }' to 'with { type: "json" }'.
- 2If using --erasableSyntaxOnly, refactor code to remove enums, namespaces, and constructor parameter properties.
- 3Review return statements where conditional logic was previously inferred as a union of types.
Release Summary
TypeScript 5.8 introduces the --erasableSyntaxOnly flag, improves type checking for conditional return expressions, and updates import attribute requirements to align with modern Node.js standards.
Need More Details?
View the full release notes and all changes for TypeScript v5.8-rc.
View Full Changelog