Seeking Advice on Using IOC Containers with Effect's Layers API in Typescript Project

Hey folks! I hope you all going well!
I was wondering what is your stance on IOC containers. I am a big fan of ioc do pattern and I'm currently working on a container implemented using your layers API and slowly tearing all of my leftover hair 😄 is it generally a bad idea to try and do it using effect? I see that you can inline and provide layers to effects which is fine, but I would simply prefer to have a single place where I could provide some configuration of currently used services. I tried doing it using the Effect.Service, but keep running into yielding problems where my dependencies are undefined. Had to whack a bunch of "as X" and "any's" to even get things to be put together dynamically but seems that I am doing things wrong. I tried to understand what is happening in the Effect.Service to work out how do I need things typed to avoid having use "trust me bro" methods, but feelt intimidated by type structure to say the least.
Is there a better way to declare services within some container class so that effect's runtime knows how to yield stuff?
I tried declaring classes dynamically within a private map extending Effect.Service within the class, after sorting passe config topologically and then created iterator in hope that yielding will work but feels like ancapsulating things inside a class just breaks stuff.
Is there some recommendations you could give me that would be useful to build such container?
The idea is relatively simple - initialize the class with some defined config that describes the services and dependencies and class then utilises effects built in APIs to provide me with currently used service after calling it. Not sure if I'm describing things clearly enough, but having hopes that someone could advise 🙂
Was this page helpful?