Honestly, this video took the core of dependency injection using tsyringe and decoupled it in approximately 7 minutes. Nice one Kris Foster, it's hard to find conciseness merged with in-depth these days.
I think the only thing that’s missing here is where you would be using interfaces rather than concrete implementations, which is where you’d likely start using a ServiceLocator; having said that I’m quite unfamiliar with this library and would be interested to see how they’ve went about usage in more complex applications
Fantastic short course, exactly what I was looking for! Thank you so much!
This was very helpful, short and straight to the point.
Cool video, auto injection shouldn't be used in production environments though. Would love to see you do a follow up video on instance vs singleton and the container file
Excellent simple debunk of DI even for a beginner like me, awesome!
This is really good ...I noticed that you use class based implementations in express....could you do a video on how you structure an express app in class based implementations and testing it ... obviously with typescript...cheers 🔥
довольно интересно. Осталось научиться применять эти знания на практике)
Is tsyringe web compatible? I can imagine great usecase for React
you say we are automatically injecting the dependencies, but not what that really means; like in the constructor, its specifying a type, is that just automatically picking that type as the dependency to inject too?
@Kris - Thank you for creating such a great content. I;m facing issue when Im testing my dependency services with Jest unit test framework. Would you mind to share if there is any sample code or tutorial?
Can u explain how to use this DI in React Component?
Great video. Can you do another one in TSyringe for mocks + Jest + SuperTest?
don't get it you have a direct dependency in BookService for example, it's not like your're saying the injected dependency has to conform to an interface, its a class. How do I swap some other service in . What am I missing , this is obviously useful ?
What if BookRepository have a dynamic property? E.g. library: 'library1'|'library2'. Can I control it from BookController?
Great video, and thank you for choosing a package maintained by Microsoft! How about just having an index file for the controller where, with a function, you just manually export an instance of the controller with all its dependencies? That is, just creating your own container.
Man, you are a god. That's the first time that i understand di
This was well done, and what it covers is good, but I feel like you missed explaining one of the main usages of DI and these containers, which is using mocks and setting those in the DI framework. It also doesn't explain how to handle the situation where a dependency that we want to autoInject requires parameters in the constructor. Both are pretty common imo.
thanks alot, this was exactly what i needed
@alexcoroza4518