inversify / InversifyJS

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

Throw a meaningful error for cyclic dependencies #28

Closed avs14093 closed 8 years ago

avs14093 commented 8 years ago

How does inversify manage cyclic dependencies?

Could not find anything in the documentation yet.

remojansen commented 8 years ago

Hi @avs14093 at the moment InversifyJS throws a stack overflow error if there are circular dependencies but I will look into the possibility of offering something better than that in the future.

jamesadarich commented 8 years ago

Hey Remo,

Just to clarify on this issue - will the feature be too detect cyclic dependencies in a tree and throw a meaningful error when they are found rather than trying to resolve a cyclic dependency?

remojansen commented 8 years ago

We are not going to remove cyclic dependencies. It seams to be what other big projects are doing:

As you said we are going to try to throw a meaningful error.

remojansen commented 8 years ago

This is now merged into master 81817a30e61fd7ac5511721d15285e27aba7f173

remojansen commented 8 years ago

There was an issue in some Node.js versions but it has been fixed by dab6e544914d9142629ed51f199a10e04bc923a8