I have developed a custom service provider that accepts a class as a parameter to retrieve an existing instance. I want to be able to use it like this:
class MyService{
doSomething(){
console.log("something");
}
}
var myServiceInstance = serviceProvider.get<MyService>();
myServiceInstance.doSomething();
The issue is that currently I need to specify the class again when calling the get method:
serviceProvider.get<MyService>(MyService);
This seems inelegant. Is there a way to design the service provider interface so that the class reference can be internally retrieved based on the specified generic parameter?