Allow inference of class generics when declaring an interface #32044
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Search Terms
interface, inference, extending class
Suggestion
I'd like to be able to strongly type an interface such that when it is used on a class that has a generic I can infer the type of that generic to then use in the declaration of the interface.
Use Cases
I want to use this within a library that exposes both an abstract class and an optional interface that developers can opt-in to use. The abstract class has one generic parameter, and in order to correctly type the interface without duplicate generic declaration I want to be able to infer the abstract class' generic type.
Currently the inheriting class declarations must duplicate their generic type declaration.
This issue is similar to #26242 I think, but I don't see how the resolution of that issue will fix this one.
Examples
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: