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
Currently, instance operator narrowing order is left to right and non-generics to generics, but should not have order of non-generics to generics. Narrowing order should only depend definition order in union types.
classA<T>{prop: T;}classB<T>extendsA<T>{}classCextendsA<any>{}varab: A<string>|B<string>;if(abinstanceofA){ab;// A<string>}varba: B<string>|A<string>;if(bainstanceofA){ba;// B<string>}varca: C|A<string>;if(cainstanceofA){ca;// C}varac: A<string>|C;if(acinstanceofA){ac;// C, should be A<string>}
Note: TypeScript should provide the way that select the most closest type by definition order in union types for alternate method of pattern matching.
Currently,
instance
operator narrowing order is left to right and non-generics to generics, but should not have order of non-generics to generics. Narrowing order should only depend definition order in union types.Note: TypeScript should provide the way that select the most closest type by definition order in union types for alternate method of pattern matching.
derived from #6589
The text was updated successfully, but these errors were encountered: