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
interfaceA<S>{a: S}interfaceB<S>{b: S}interfaceC<S>{c: S}typeU1<S>=A<S>|B<S>|C<S>functionf1<S>(u: U1<S>): u is B<S>|C<S>{returnfalse}functiontest1<S>(x: U1<S>){if(!f1(x)){x.a//OK}}typeCond<S>=Sextendsnumber ? B<S> : C<S>typeU2<S>=A<S>|Cond<S>functionf2<S>(u: U2<S>): u is Cond<S>{returnfalse}functiontest2<S>(x: U2<S>){if(!f2(x)){x.a//ERROR}}
π Actual behavior
The type guard is unable to narrow the type of x to A
π Expected behavior
The type guard should narrow the type of x to A because it is not assignable to Cond<S>
Bug Report
π Search Terms
type guard conditional typeπ Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
The type guard is unable to narrow the type of
xtoAπ Expected behavior
The type guard should narrow the type of
xtoAbecause it is not assignable toCond<S>