How does everyone deal w…

less than 1 minute read

How does everyone deal with Types that are shared between apps and libraries? Currently we are creating shared libs for each scope that contains the types but this is starting to get a little unruly and our dependency graph is a lot to manage.


I’d say that the app should just be a consumer of the lib with the types exposed by it

What is a type (or set of types) need to be shared between multiple libraries?

I’m assuming creating “type libs” is no the best approach?

We our project we have added “models” as additional library type beside the nrwl recommended ones (feature, data-acess,ui,util)

In our project, we have a common lib shared by back-end and front-end in which we have the domain model and its main derivates (i.e., DTOs). We have variants of those base types in other libs (e.g., ViewModel definitions in the features)

But our system is quite simple so it remains manageable with a single lib :wink: