inversify / InversifyJS

A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript.
http://inversify.io/
MIT License
11.33k stars 718 forks source link

naming mismatch #123

Closed acopalipsis closed 8 years ago

acopalipsis commented 8 years ago

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?

remojansen commented 8 years ago

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 inversify@2.0.0-alpha.3

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

remojansen commented 8 years ago

I have updated the docs to display:

$ npm install inversify@2.0.0-alpha.3 --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.

acopalipsis commented 8 years ago

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

remojansen commented 8 years ago

No problem. We don't use tsd because it is deprecated. Right now we are in inversify@2.0.0-alpha.3 but once we go into a production ready release (inversify@2.0.0) 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.