Answer the question
In order to leave comments, you need to log in
Generics in @Input?
Is it possible to use generics in inputs? From the fact that I googled all the solutions are too complicated. How do you type props for reusable components?
Answer the question
In order to leave comments, you need to log in
From the point of view of typescript, there are no inputs, these are ordinary public fields.
Generics As usual, a class defines a variable type and can be extended to fields.
class MyComponent<T> {
@Input() prop: T;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question