InversifyJS icon indicating copy to clipboard operation
InversifyJS copied to clipboard

naming mismatch

Open acopalipsis opened this issue 10 years ago • 4 comments

Am I the only one who tried to launch this DI? Why in all examples import inject, while in js code there is only Inject?

import {Kernel, Inject} from 'inversify';

const kernel = new Kernel();

kernel.bind('IObject').toValue({isObject: true});

console.log(kernel.get('IObject'));

why?

PhantomJS 2.1.1 (Linux 0.0.0) ERROR Error: Argument Null

import {Kernel, Inject} from 'inversify';

const kernel = new Kernel();

console.log(kernel.getAll, kernel.get); // null, null

this DI is still not done?

acopalipsis avatar Mar 14 '16 20:03 acopalipsis

Hi @acopalipsis can you please use the issue template it helps us to support users like you.

We need to know what version of node.js you are using and most important which version of InversifyJS you are using.

In version 1.x the decorator was called Inject in version 2.x it is called inject. Also in version 1.x the methods getAll and get from kernel are not defined.

So it looks to me like you are using 1.x with the documents of 2.x. Please try to install the alpha release:

$ npm install [email protected]

We have a page that details How to upgrade from 1.x to 2.x.

remojansen avatar Mar 14 '16 21:03 remojansen

I have updated the docs to display:

$ npm install [email protected] --save

instead of:

$ npm install inversify --save

This should help others don't encounter the same problem. Please let us know if this solved your problem.

remojansen avatar Mar 14 '16 21:03 remojansen

Thanks for help. Even had to abandon the Declaration established through tsd.

acopalipsis avatar Mar 15 '16 10:03 acopalipsis

No problem. We don't use tsd because it is deprecated. Right now we are in [email protected] but once we go into a production ready release ([email protected]) we will send the type definitions to typings so it will be possible to do:

$ typings install inversify --save

But this is not possible right now.

remojansen avatar Mar 15 '16 11:03 remojansen