Tag

erasableSyntaxOnly

0 views collected around this technical thread.

Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Mar 18, 2025 · Fundamentals

Why TypeScript Seems to Discourage Enums and What Alternatives Exist

This article explains the new --erasableSyntaxOnly option in TypeScript, distinguishes erasable from non‑erasable syntax, shows why enums are considered problematic, and presents several practical alternatives such as const enums, template literal types, union types, const assertions, and class‑based enums.

TypeScriptalternativesenum
0 likes · 10 min read
Why TypeScript Seems to Discourage Enums and What Alternatives Exist