Change8

v5.8.3

Breaking Changes
📦 typescriptView on GitHub →
2 breaking5 features🐛 4 fixes1 deprecations🔧 5 symbols

Summary

TypeScript 5.8 introduces the --erasableSyntaxOnly flag, support for Node.js 18 module resolution, and optimizations for ESM interoperability while deprecating older import assertion syntax.

⚠️ Breaking Changes

  • Granular checks for 'use strict' in files: TypeScript now strictly enforces that certain prologue directives cannot appear after non-prologue statements.
  • Restrictions on Import Assertions: The deprecated 'assert' syntax in imports now triggers a warning/error in favor of 'with' (attributes).

Migration Steps

  1. If using Node.js 18+, consider updating 'module' and 'moduleResolution' settings to 'node18' in tsconfig.json.
  2. Replace 'assert { type: "json" }' with 'with { type: "json" }' in dynamic and static imports.
  3. Check for new errors if using strict prologue directives (e.g., 'use strict').

✨ New Features

  • Granular Control of Erasable Syntax with --erasableSyntaxOnly flag.
  • Support for 'module': 'node18' which provides a stable target for Node.js 18 users.
  • Improved support for 'module': 'nodenext' in environments that support ECMAScript modules.
  • Optimized '--isolatedModules' behavior for faster builds.
  • Support for 'require()' of ECMAScript modules in Node.js under certain conditions (via --module nodenext/node18).

🐛 Bug Fixes

  • Fixed issues related to milestone 5.8.0 (Beta).
  • Fixed issues related to milestone 5.8.1 (RC).
  • Fixed issues related to milestone 5.8.2 (Stable).
  • Fixed issues related to milestone 5.8.3 (Stable).

🔧 Affected Symbols

--erasableSyntaxOnly--module node18importrequiretsconfig.json

⚡ Deprecations

  • The 'assert' keyword in import attributes is now deprecated in favor of 'with'.