Closed adamdry closed 6 years ago
Hi @adamdry,
I tried your code, but it worked as expected here. No error occurred. I saw that the version declared in package.json was 1.0.2. When I ran npm i, it installed the newest 1.1.1.
I don't know what caused the error to you, but can you try again with this new version?
Thanks, this is indeed now fixed! :+1:
I met same error message when missing emitDecoratorMetadata: true
in my tsconfig.json ("version": "1.2.5")
[2019-10-07T23:52:26.965] [FATAL] launcher - Invalid type requested to IoC container. Type is not defined. TypeError: Invalid type requested to IoC container. Type is not defined.
at checkType (service/node_modules/typescript-ioc/src/typescript-ioc.ts:356:15)
at Function.bind (service/node_modules/typescript-ioc/src/typescript-ioc.ts:301:9)
at Function.get (service/node_modules/typescript-ioc/src/typescript-ioc.ts:312:49)
at RuntimeImpl.get [as hostingService] (service/node_modules/typescript-ioc/src/typescript-ioc.ts:334:85)
I think(proposal) this case should be detected in runtime with a warning message. @adamdry if you you agree with my proposal let me know and I will return with a merge request...
I have 2 simple classes and an index.ts entry script.
index.ts looks like this:
ConfigHelper looks like this:
FsAsyncFactory looks like this:
But when I run it I get an output of:
I have a public repo here if you'd like to try for yourself (use this specific commit): https://github.com/adamdry/node-di-mocha-test/commit/120475877fbc08af0ed436560ce4e735c4b450c4
To run the demo:
npm i
npm run dev
I imagine I'm doing something stupid though... :)
Thanks.