Managing typescript project monorepo with yarn and ts 3.0 Managing typescript project monorepo with yarn and ts 3.0 typescript typescript

Managing typescript project monorepo with yarn and ts 3.0


At the moment I have 2 tsconfig files, I believe I can somehow merge them into one?

You can't specify separate compilation targets from a single tsconfig file I believe, but if you want to lower the amount of repetition across files you can define a master tsconfig.json containing common configurations at the root of your project and have your project-specific tsconfig.jsons extend from the master.

is there a way for me to define multiple .d.ts files instead of my types filder and make my model and store interfaces available globally across projects somehow?

Yes you can certainly define as many .d.ts files as you like anywhere you like and include them either in a tsconfig.json or ad hoc per file using a triple-slash directive:

  • If you want to include them ad-hoc in each file, you'll need to use the triple-slash reference directive and pass the .d.ts filepath as the argument.
  • The easier way is to make them available to the compiler via tsconfig. If you use the "files" or "include" arrays to specify compiler inputs, simply add the relevant .d.ts files to the list. If you use only the "exclude" array, then make sure you don't exclude your .d.ts files.

You'll likely want to keep yarn workspaces around as TS 3.0 has no tooling that can replace workspaces.

Hope this helps.