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
typeT={path: ['one'],value: string}|{path: ['two'],value: number}functionfoo(payload: T){if(payload.path[0]==='one'){payload.value// string | number, should be just string}}
Bug Report
π Search Terms
destructuring destructured dependent parameters nested control flow analysis
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
TypeScript does not correctly narrow
val2
when narrowingval1
if it's in any type of nested destructuring.π Expected behavior
I expect it to behave the same as directly destructuring the object.
The text was updated successfully, but these errors were encountered: