lazyInject should be a usable decorator, instead it's just null or undefined or something else :-(
Somehow this gets thrown away.
getDecorators to create the lazy inject decoratorexport { lazyInject };
Here is the error stack: TypeError: ioc_1.lazyInject is not a function
extensionHostProcess.js:292
at Object.<anonymous> (/Users/christoph/Documents/Development/typescript-hero/out/src/declarations/workspace-declarations.js:24:11)
at Object.<anonymous> (/Users/christoph/Documents/Development/typescript-hero/out/src/declarations/workspace-declarations.js:29:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Function.J.X.t.getExtensionPathIndex.then.o._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:490:709)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
Hi @buehler, I tried to take a look to your code but I was unable to find lazyInject. It looks to me like there is some sort of issue with the modules. The error seems to be at:
/src/declarations/workspace-declarations.js:24:11
My guess is that workspace-declarations.js had a dependency on ioc.js because it was importing lazyInject` but at runtime the import is not a funcion.
I would try to debug the following to see what is happening. I would expect this issue to be reported by many but so far this is the first case so my guess is that is is likely something wrong with the modules not with inversify-inject-decorators:
const decorators = getDecorators(container);
const lazyInject = decorators. lazyInject;
Please let me know how it goes and feel free to ask more questions I will b happy to try to help.
@remojansen Hi! I am facing the same problem. I have two modules, let's call them A and B. Module A exports all classes that I want to be injected and module B exports the inversify configuration (container initialization, bindings declaration and decorators creation). I think that the problem comes with circular dependency. Module A is imported in module B to declare the bindings and module A imports the lazyInject decorator from module B, then the error occurs.
I had a similar issue because lazyInject was exported from my configuration after it was used in service. So that's why it was undefined in runtime.
Same issue here. Tried every suggestion here, but still get this error.
Same for me
Most helpful comment
@remojansen Hi! I am facing the same problem. I have two modules, let's call them A and B. Module A exports all classes that I want to be injected and module B exports the inversify configuration (container initialization, bindings declaration and decorators creation). I think that the problem comes with circular dependency. Module A is imported in module B to declare the bindings and module A imports the lazyInject decorator from module B, then the error occurs.