How to handle Typescript dependency in a monorepo?

130 Views Asked by At

I have a monorepo using npm workspaces, the structure is as follows:

web
  -package.json

api
  -package.json

common
  -package.json

package.json

I have some utility functions and types in "common" package which I use in my web and api packages. Do I need to install typescript as a dev dependency in each package or installing it at the root folder is enough (my current setup) what are the cons/pros? One more question if I have some utility that is in the api package and want to use it in the web package do I need to move it to "common" package and import from there or I can directly import from the api package? Thanks

0

There are 0 best solutions below