You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The shouldWorkButDoesNot function has a type error. It shouldn't have a type error because no matter what o.type is, ...o.data will always include the required props.
The function below (worksButSoUnnecessary ) works by type checking o.type, but since both parts of the ternary are exactly the same, the type checking is completely useless. However, it still needed?? for there to not be any typescript errors.
π Expected behavior
The function shouldWorkButDoesNot should not have an error.
See #30581; o.type and o.data are correlated in a way the compiler does not understand unless you walk it through the different cases via control flow analysis.
Activity
jcalz commentedon Jan 25, 2021
See #30581;
o.typeando.dataare correlated in a way the compiler does not understand unless you walk it through the different cases via control flow analysis.ChocolateLoverRaj commentedon Jan 26, 2021
Duplicate of #30581