enum Role { Admin, User }The enum Role { Admin, User } line fails. Node only strips erasable syntax: type syntax it can remove without generating any code. An enum needs generated JavaScript, so it fails unless you add --experimental-transform-types.
The other three lines are pure type syntax, so Node just removes them:
• interface User { id: string }
• the : string annotations in function greet(name: string): string
• import type { User } from "./types.ts";
TypeScript 5.8's erasableSyntaxOnly option reports such constructs at compile time.
Read more