Dependency injection in Typescript. Constructor? Setter? Factory method?
Decoupling class relationships is important for unit testing. Less cohesion makes writing unit tests easier. This post shows 3 ways to do it. Constructor injection, setter injection, and using the factory method to inject the desired instance.
2020.09.13
JavaScript/TypeScript