Skip to main content
Frontend
Interviews
.dev
Problems
725. TypeScript Discriminated Union Switch
Medium
•
...
Select the best answer.
type
Res
=
{
kind
:
'ok'
;
data
:
string
}
|
{
kind
:
'err'
;
message
:
string
}
;
How does TS narrow branches safely?
Discriminant literal checks
Runtime reflection
Any-casting by default
Decorator metadata
Submit Answer
Reveal Answer
Select an option and submit your answer.
Next Problem
Auto-advance on correct answer