thiagobustamante / typescript-ioc

A Lightweight annotation-based dependency injection container for typescript.
MIT License
526 stars 64 forks source link

Help with Container instance #73

Open fabiocavalcantezup opened 4 years ago

fabiocavalcantezup commented 4 years ago

Hi,

Can someone help me to solve a problem. Im using typescript-ioc in 2 modules and module B dependes on module A. The problem is, somehow the Container instance used in each library seems to be different (which makes sense).

My question is, there anyway to share Container instance between two libraries?

Thanks in advance

Edit: I already solved by exporting the instance of Container from A to B, but it seems that i should have not do this.

Kampfmoehre commented 3 years ago

You must use the same typescript-ioc instance across libraries. In module A don't install typescript-ioc directly but via peer-dependencies and let module B instasll typescript-ioc. This way the same "instance" of Container is used.