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
Missing narrowing of intersections involving type parameter and primitive typesΒ #43130
functionf1<T>(x: T&string|T&undefined){if(x){x;// Should narrow to T & string}}functionf2<T>(x: T&string|T&undefined){if(x!==undefined){x;// Should narrow to T & string}else{x;// Should narrow to T & undefined}}functionf3<T>(x: T&string|T&number){if(typeofx==="string"){x;// Should narrow to T & string}else{x;// Should narrow to T & number}}functionf4<T>(x: T&1|T&2){switch(x){case1: x;break;// T & 1case2: x;break;// T & 2default: x;// Should narrow to never}}functionf5<Textendsstring|number>(x: T&number){constt1=x==="hello";// Should be an error}
Activity