type Role = "ADMIN" | "USER";function canDelete(role: Role) { … }canDelete("ADMIN"Argument of type "ADMIN" is accepted as RoleThe union checks spelling, but cannot require this value to come from a shared declaration.); // compiles
String unions stop typos, but still accept raw members wherever a Role is expected. Reviewers cannot tell whether ADMIN came from the declaration or memory.