So I have my main application and I have created a component library.
I would like for my main application to have some sort of translation service that can also be injected into my component library components.
Is this possible? How will typescript react? What if I just have the component library, but not access to the main application - is there a way to mock this?
You will have to create a ‘dummy’ translate service in your library that shares the same interface as the one in your main app, so that the library components can include it in the constructor to be injected.
Then, in your main app you can override the provider in your app module.
The ‘proper’ way to do it would be to extract your translate service to a library of its own, and then import that library in to both your main app and custom library, but that does come with more maintenance.