|
|
|
|
|
by xsmasher
1425 days ago
|
|
What would you use for a field called "stage" that could be set to 'dev' or 'stage' or 'prod'? Or other enum-type things? I've seen pure JS enums like {'dev' : Symbol('dev'), 'prod' : etc} but I never use them because you can't send them over the wire. You could use a type like {dev:true} | {prod:true} | {stage:true} but you still wind up comparing strings. |
|
This can't be accessed safely. Because all value in typescript can be sub type of how it typed.
It means code following will pass.
And there is no guarantee that access any of these fields is safe.