<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/typescript-5-8-production-migration-adopting-erasable-syntax-for-node-js-23--yvv1s2bui" -->

---
title: TypeScript 5.8 Production Migration: Adopting Erasable...
description: TypeScript 5.8 introduced the `erasableSyntaxOnly` compiler option, and Node.js 22.6+ ships with built-in type stripping via `--experimental-strip-types`,...
canonical: https://daily.dev/posts/typescript-5-8-production-migration-adopting-erasable-syntax-for-node-js-23--yvv1s2bui
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: TypeScript 5.8 Production Migration: Adopting Erasable Syntax for Node.js 23+ | daily.dev
og:description: TypeScript 5.8 introduced the `erasableSyntaxOnly` compiler option, and Node.js 22.6+ ships with built-in type stripping via `--experimental-strip-types`,...
og:url: https://daily.dev/posts/typescript-5-8-production-migration-adopting-erasable-syntax-for-node-js-23--yvv1s2bui
og:image: https://api.daily.dev/og/posts/yvV1S2BuI.png
og:image:alt: TypeScript 5.8 Production Migration: Adopting Erasable Syntax for Node.js 23+
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript 5.8 Production Migration: Adopting Erasable Syntax for Node.js 23+

**[SitePoint](https://daily.dev/sources/sitepoint)** · 16 min read · 0 upvotes · 0 comments

## Summary

TypeScript 5.8 introduced the `erasableSyntaxOnly` compiler option, and Node.js 22.6+ ships with built-in type stripping via `--experimental-strip-types`, enabling `.ts` files to run directly in production without a transpilation step. This guide covers the full migration: auditing codebases for non-erasable constructs (enums, constructor parameter properties, namespaces), replacing them with `as const` objects and explicit ES module exports, configuring `tsconfig.json` for type-check-only mode, updating `package.json` scripts, simplifying Docker builds to single-stage, and adjusting CI/CD pipelines. Key caveats include: `as const` objects lack reverse mappings unlike TypeScript enums, legacy decorators remain incompatible, and library authors still need `tsc` for `.d.ts` generation. A production migration checklist and performance considerations for startup time and source maps are also provided.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.sitepoint.com/typescript-58-migration-erasable-syntax-node-23-production>

## Questions this post answers

### What is the erasableSyntaxOnly compiler option in TypeScript 5.8 and why does it matter for Node.js?

erasableSyntaxOnly is a TypeScript 5.8 compiler option that enforces every TypeScript construct in a codebase be removable without altering runtime behavior, so the code can run directly via Node.js 22.6+'s built-in type stripping (--experimental-strip-types). It flags non-erasable constructs like enum, const enum, namespace blocks with runtime code, constructor parameter properties, and legacy import=require() syntax with error TS1294.

_Developers planning a build-free TypeScript setup can track compiler changes like this one on daily.dev._

### How do I replace a TypeScript enum with an erasable alternative for Node.js type stripping?

Replace enum or const enum declarations with an object literal marked 'as const', then derive a type union from its values using typeof and keyof. Unlike enums, as const objects do not provide reverse mappings, so if the original code did reverse lookups like Status[value], build a separate reverse-lookup map with Object.fromEntries to avoid silent undefined returns at runtime.

_Anyone refactoring enums for erasable syntax can follow migration patterns like this via daily.dev._

### What Node.js and TypeScript versions are required to run .ts files directly without a build step?

Node.js 22.6.0 or later is required for the --experimental-strip-types runtime flag, alongside TypeScript 5.8 or later for the erasableSyntaxOnly compiler option. Node.js 24+ is expected to support type stripping unflagged, though this should be verified against official release notes. Projects on Node.js versions below 22.6 cannot use type stripping at all.

_Teams deciding when to drop their TypeScript build step can track version requirements like these on daily.dev._

## Similar posts on daily.dev

- [TypeScript 5.8 Erasable Syntax: Running TS Directly in Node.js](https://daily.dev/posts/typescript-5-8-erasable-syntax-running-ts-directly-in-node-js-pbsbjqf1y) · SitePoint · 1 upvotes · 0 comments
- [Why TypeScript Enums Are Dead](https://daily.dev/posts/why-typescript-enums-are-dead-gev3gojxj) · TypeScript.TV · 62 upvotes · 0 comments

---

Tags: [#nodejs](https://daily.dev/tags/nodejs), [#typescript](https://daily.dev/tags/typescript), [#cicd](https://daily.dev/tags/cicd), [#docker](https://daily.dev/tags/docker)

[View this post on daily.dev](https://daily.dev/posts/typescript-5-8-production-migration-adopting-erasable-syntax-for-node-js-23--yvv1s2bui)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"TypeScript 5.8 Production Migration: Adopting Erasable Syntax for Node.js 23+","url":"https://daily.dev/posts/typescript-5-8-production-migration-adopting-erasable-syntax-for-node-js-23--yvv1s2bui","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/typescript-5-8-production-migration-adopting-erasable-syntax-for-node-js-23--yvv1s2bui"},"datePublished":"2026-07-15T00:17:56.985Z","dateModified":"2026-09-13T21:29:56.169Z","description":"TypeScript 5.8 introduced the `erasableSyntaxOnly` compiler option, and Node.js 22.6+ ships with built-in type stripping via `--experimental-strip-types`,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/621b165e256b9a86618414c0ebcc0ec5?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/621b165e256b9a86618414c0ebcc0ec5?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"SitePoint","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"SitePoint","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/sitepoint","url":"https://daily.dev/sources/sitepoint"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/typescript-5-8-production-migration-adopting-erasable-syntax-for-node-js-23--yvv1s2bui","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"nodejs,typescript,cicd,docker","timeRequired":"PT16M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"SitePoint","item":"https://daily.dev/sources/sitepoint"},{"@type":"ListItem","position":3,"name":"TypeScript 5.8 Production Migration: Adopting Erasable Syntax for Node.js 23+"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/typescript-5-8-production-migration-adopting-erasable-syntax-for-node-js-23--yvv1s2bui#faq","mainEntity":[{"@type":"Question","name":"What is the erasableSyntaxOnly compiler option in TypeScript 5.8 and why does it matter for Node.js?","acceptedAnswer":{"@type":"Answer","text":"erasableSyntaxOnly is a TypeScript 5.8 compiler option that enforces every TypeScript construct in a codebase be removable without altering runtime behavior, so the code can run directly via Node.js 22.6+'s built-in type stripping (--experimental-strip-types). It flags non-erasable constructs like enum, const enum, namespace blocks with runtime code, constructor parameter properties, and legacy import=require() syntax with error TS1294. Developers planning a build-free TypeScript setup can track compiler changes like this one on daily.dev."}},{"@type":"Question","name":"How do I replace a TypeScript enum with an erasable alternative for Node.js type stripping?","acceptedAnswer":{"@type":"Answer","text":"Replace enum or const enum declarations with an object literal marked 'as const', then derive a type union from its values using typeof and keyof. Unlike enums, as const objects do not provide reverse mappings, so if the original code did reverse lookups like Status[value], build a separate reverse-lookup map with Object.fromEntries to avoid silent undefined returns at runtime. Anyone refactoring enums for erasable syntax can follow migration patterns like this via daily.dev."}},{"@type":"Question","name":"What Node.js and TypeScript versions are required to run .ts files directly without a build step?","acceptedAnswer":{"@type":"Answer","text":"Node.js 22.6.0 or later is required for the --experimental-strip-types runtime flag, alongside TypeScript 5.8 or later for the erasableSyntaxOnly compiler option. Node.js 24+ is expected to support type stripping unflagged, though this should be verified against official release notes. Projects on Node.js versions below 22.6 cannot use type stripping at all. Teams deciding when to drop their TypeScript build step can track version requirements like these on daily.dev."}}]}
```

