Concept Flow - Why type narrowing is needed
Start: variable with union type
Check type with condition
Use narrowed type
End
We start with a variable that can be multiple types. We check its type using a condition. If the check passes, we safely use the variable as the narrowed type. Otherwise, we handle the other type.