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
{{ message }}
Repository navigation
Compilation error with possibly nullable object #15482
The type of one of the keys is not a discriminant. in both examples, the type of val2 is string|null narrowing val1 does not narrow the type of the return value of func3.
Moreover, it is really hard to for the compiler to build a relationship between two variables in such a destructuring pattern.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
kitsonk commentedon May 1, 2017
It seems like for objects, the compiler properly tracks the types, as this works:
So it seems the compiler doesn't properly track and narrow tuple members in the same way it does object property members.
mhegazy commentedon May 1, 2017
The type of one of the keys is not a discriminant. in both examples, the type of
val2isstring|nullnarrowingval1does not narrow the type of the return value offunc3.Moreover, it is really hard to for the compiler to build a relationship between two variables in such a destructuring pattern.
see: #14630, #10976, #12263, #10065, and #10846
mhegazy commentedon May 19, 2017
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.