Book: PHP to TypeScript — A Bridge for Modern PHP 8+ Developers Also by me: The TypeScript Library — the 5-book collection My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools Me: xgabriel.com | GitHub You write enum Status in TypeScript and assume the bridge from PHP is built. It is not. PHP's enum is a runtime class with method dispatch and exhaustive match . TypeScript's enum is a compile-time hint that emits an unwanted IIFE. Same keyword, different semantics. The TypeScript handbook documents the pitfalls of enum and points to literal-type unions as the alternative for almost every case. There is a clean translation. It is not the keyword. It is a discriminated union plus a same-named namespace that holds the companion methods. The values live in the type. The methods sit in a same-named namespace next to it. At the call site, OrderStatus.label(status) looks almost exactly like Status::Active->label() did in PHP.…