Hello Dany Paredes!
Thank you for the article. It reminded me of when I passed an injector from a child class to a parent class, but after a short period of time, I rewrote everything back. Here is a small example:
` class Base { protected param: Param; protected param1: Param1;
constructor(injector: Injector) { this.param = injector.get(Param); this.param1 = injector.get(Param1); } }
class Child extends Base { constructor(injector: Injector, private childParam: ChildParam) { super(injector); } } `
When we use the injector(in your case is a "inject()") as a service locator, we violate the encapsulation, we also violate the segregation of interfaces. In general, the service locator is an anti-pattern. Based on that, don't you think it's the same thing? Because now it is not clear what dependencies are needed to make this class work.