Loading...
class User {
constructor(private name: string) {}
}
enum Status { Active, Banned }class User {
private name: string;
constructor(name: string) {
this.name = name;
}
}
type Status = 'active' | 'banned';Parameter properties and enum emit runtime code; explicit fields and a literal union erase cleanly.
enum that only a full compiler can handle.as const objects instead of enum.Only namespaces that contain types alone, which emit no code. A namespace with values is reported as an error.
Yes, if the code runs with type stripping, such as in Node.js without a build step. It reports problem syntax at compile time instead of at runtime.