v5.8-beta
Breaking Changes📦 typescript
⚠ 2 breaking✨ 4 features🐛 1 fixes🔧 5 symbols
Summary
TypeScript 5.8 Beta introduces the --erasableSyntaxOnly flag for better compatibility with non-TS transpilers and refines module resolution for Node.js environments.
⚠️ Breaking Changes
- The --module nodenext flag now enforces that 'use external' and other non-standard module behaviors are restricted to ensure compatibility with Node.js's native ESM implementation.
- Stricter checks on 'module' and 'moduleResolution' settings to prevent invalid configurations when targeting modern runtimes.
Migration Steps
- If using --erasableSyntaxOnly, ensure that enums and namespaces are refactored if they are intended to be stripped by simple transpilers.
- Review module resolution settings if upgrading from a version prior to 5.0.
✨ New Features
- Granular control over 'Erasable Syntax' with the new --erasableSyntaxOnly flag to ensure code can be compiled by tools like swc or esbuild without TypeScript-specific transformations.
- Support for 'Simplified Reference Requirements' in --module nodenext, allowing for easier imports of ESM files without explicit extensions in certain scenarios.
- Improved 'Required Template Literal Types' inference.
- Support for 'module' setting 'node18'.
🐛 Bug Fixes
- Fixed various issues related to module resolution and declaration file generation as tracked in the 5.8.0 milestone.
🔧 Affected Symbols
--erasableSyntaxOnly--module--moduleResolutionnodenextnode18