Y
Hacker News
new
|
ask
|
show
|
jobs
by
seniorsassycat
1614 days ago
You can do that with sum types.
type methods = 'a' | 'b' const value: methods = 'c' // error
The difference is enums are also nominal, while most types are structural.