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
Breaking ChangeWould introduce errors in existing codeBugA bug in TypeScriptWon't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix it
Since the type of x seems to take the value of b into account, should the type even be string?
let b: boolean;
let s: string;
let x1 = b && s; // string, (which should it be? x1 is undefined)
b = true;
let x2 = b && s; // string
b = false;
let x3 = b && s; // boolean
Breaking ChangeWould introduce errors in existing codeBugA bug in TypeScriptWon't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix it
Activity
AlCalzone commentedon Aug 15, 2018
Since the type of
xseems to take the value ofbinto account, should the type even bestring?markusjohnsson commentedon Aug 15, 2018
With
strictNullChecks, you will getstring | boolean.RyanCavanaugh commentedon Aug 15, 2018
Anders Hejlsberg (@ahejlsberg) in non-SNC we should really be keeping the left operand type in the result when it's a primitive
ahejlsberg commentedon Aug 15, 2018
We've discussed fixing this before, but decided against it because of the breaking change. Do we feel differently about this now?
In general, if you care about precise types you really should be using
--strictNullChecks(where we type this correctly).RyanCavanaugh commentedon Aug 15, 2018
I don't recall that discussion. We could check RWC for impact - seems like we'd reveal a ton of subtle bugs
RyanCavanaugh commentedon Aug 20, 2018
RWC results were nothing but false positives. Doesn't seem worth breaking at this point.