Q:

How do I add code from a Common project into my back-end?

I have been trying to import code from my Common code project into my backend code. My file structure is as follows:
client (React)
 - tsconfig.json
common
 - tsconfig.json
 - src (rootDir)
   - ItemType.ts
 - lib (outDir)
server
 - tsconfig.json
 - src (rootDir)
   - index.ts
 - lib (outDir)

server/tsconfig.json has a reference to common, and common/tsconfig.json has "composite": true. Running tsc -b in the server directory successfully builds common as well, so I feel like this works. This makes it possible for me to do the following in server/index.ts:
import { ItemType } from '../../common/lib/ItemType'

However, I don't think this is the right way to do this, as I am directly importing Javascript code this way. Also, adding "@common/*": ["../common/lib/*"] under paths (with "baseUrl": "./") in server/tsconfig.json fails to allow me to use @common/ItemType instead of ../../common/lib/ItemType in my import.
Does anybody know how I can solve this issue?
I am trying to share some code between client and server (mainly enums that are used in both projects).
I am trying to get it to work with my backend first, which is the reason for not having done anything to client/tsconfig.json yet.

A:

Yarn workspaces seem to be the easiest answer (thanks @Jerome).
You can read more on them here: https://classic.yarnpkg.com/en/docs/workspaces/.
Small summary:

Create a package.json in the root of your projects.
Add the names of all your projects to this file. E.g.:

  "workspaces": ["client", "server", "common"]

You can now add any of these to your dependencies in any of your projects. They will not be installed from npm, instead a symlink is created.

This stuff is magic!
This way I am pretty much doing the same as before, but instead of having to go all the way back when importing (../../ etc) I can just import from the common node_module

