TypeScript
TypeScript is an excellent tool in monorepos, allowing teams to safely add types to their JavaScript code. While there is some complexity to getting set up, this guide will walk you through the important parts of a TypeScript setup for most use cases.
This guide assumes you are using a recent version of TypeScript and uses some features that are only available in those versions. You may need to adjust the guidance on this page if you are unable to features from those versions.
Sharing
tsconfig.json
You want to build consistency into your TypeScript configurations so that your entire repo can use great defaults and your fellow developers can know what to expect when writing code in the Workspace.
TypeScript's
tsconfig.json
sets the configuration for the TypeScript compiler and features an
extends
key
that you'll use to share configuration across your workspace.
This guide will use
create-turbo
as an example.
Use a base
tsconfig
file
Inside
packages/typescript-config
, you have a few
json
files which represent different ways you might want to configure TypeScript in various packages. The
base.json
file is extended by every other
tsconfig.json
in the workspace and looks like this:

