-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impossible to add in provider interfaces with generics. #11
Comments
Hey there, So, I do have several questions based on your issue here.
Something that is now possible in v2.2.1 that wasn't possible before is to provide type arguments when declaring a service and its implementation: interface MyInterface<T> {
}
container.registerSingleton<MyInterface<boolean>, MyClass>();
container.registerSingleton<MyInterface<boolean>, MyClass>(); Before, the compiler would assume that you wanted MyClass to only implement the service specifically called |
FYI - type with generics (ie, The issues appears to be here where: node.typeArguments[0].getFullText().trim() likely needs to be: node.typeArguments[0].getFirstToken()!.getFullText().trim() That change appears to work for me, though in the process I did notice that the tests extensively test the register calls, but do not do the same for get (and I don't think they cover types, but I didn't search all tests). |
For example
interface MyInterface {
load(a: generic){}
}
container.registerSingleton<MyInterface, MyClass>();
container.registerSingleton<MyInterface, MyClass>();
The text was updated successfully, but these errors were encountered: