Say I have this generic interface:
interface IProcessor<T>{
process(param:T):T;
}
And it's implemented like this:
interface User{
name:string;
}
class WebProcessorImplementation implements IProcessor<User>{
process(param: User): User {
console.log(`process user`);
return {
name:"User"
}
}
}
If I want to use an array of that generic interface, I get the complaint:
class Coordinator {
processors:IProcessor[] //Generic type 'IProcessor<T>' requires 1 type argument(s).ts(2314)
}
Is there a way to tell Typescript everything will be ok here and that we will be passing it full implementations of this interface and the type parameter is not needed? I'm open to other approaches to solve my use case.