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
interfaceBase{b}interfaceDerivedextendsBase{d}declarefunctionisDerived(x: Base): x is Derived;functionf<TextendsBase>(x: T,y: T){if(isDerived(x)&&isDerived(y)){returnx.d===y.d;}returnfalse;}
Currently, this errors because both x and y still have type T, so they are missing the d property.
The text was updated successfully, but these errors were encountered:
getNarrowedType doesn't check whether the type it's narrowing is a type parameter with a constraint. It just calls isTypeAssignableTo(Derived, T), which is false.
getNarrowedType needs to instead check isTypeAssignableTo(Derived, Base), but I'm not sure whether it's appropriate to narrow to Derived at that point, or to T extends Derived. Probably the latter.
@weswigham, do you have an idea of the right thing to do here?
Currently, this errors because both
x
andy
still have typeT
, so they are missing thed
property.The text was updated successfully, but these errors were encountered: