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
Do not define generic types that don't use the type parameter type.
Otherwise you will get results like this and all sorts of other undesirable behavior. The inference works correctly as long as there's actual data to make inferences from. You surely do not want a type hierarchy that works this way:
vara: Apple="yay";vartree: AppleTree=1;
Your types need to actually do something or contain some data to be meaningful.
TypeScript should be able to infer type information using the generic type parameters of an extended/implemented generic class or interface.
Example:
fruit
is inferred to be type{}
but it should beApple
.Worth noting, if
tree
is declared to beTree<Apple>
instead than a type that extendsTree<Apple>
, thenfruit
is correctly inferred to beApple
.The text was updated successfully, but these errors were encountered: