Error injecting interfaces
See original GitHub issueDescribe the bug not inject interface
To Reproduce
container.register<ITestSubService>(injection_types.ITestSubService, TestSubService);
@injectable()
class LocalStorageService implements ILocalStorageService
{
constructor(private test : ITestSubService)
{
}
}
console - Uncaught Error: Cannot inject the dependency at position #0 of “LocalStorageService” constructor. Reason: TypeInfo not known for “Object” at eval (dependency-container.js?013a:244) at Array.map (<anonymous>) at InternalDependencyContainer.construct (dependency-container.js?013a:229) at InternalDependencyContainer.resolveRegistration (dependency-container.js?013a:108) at InternalDependencyContainer.resolve (dependency-container.js?013a:79) at setup (App.vue?3acc:25) at callWithErrorHandling (runtime-core.esm-bundler.js?5c40:154) at setupStatefulComponent (runtime-core.esm-bundler.js?5c40:6224) at setupComponent (runtime-core.esm-bundler.js?5c40:6185) at mountComponent (runtime-core.esm-bundler.js?5c40:3960) Expected behavior if change ITestSubService to implementation - TestSubService all works fine
Version: 4.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top GitHub Comments
Hmm, strangely, it looks like it thinks that
injection_types
is undefined. If you test it just using raw strings rather than symbols at both registration and injection time does it work?… I just found where i got error If import container after import App, i got error.
MeltingMosaic thank you very much for your help!