Typescript: Working with Paths, Packages and Yarn Workspaces

How to modularise your Typescript projects with paths, packages and Monorepos

Ross Bulat
12 min readJun 13, 2019

Understanding packages is understanding modularity

We are all accustomed to working with packages as Javascript developers, installing and importing various dependencies that our project requires, from the framework itself to fine-tuned UI.

This article explores critical tools and concepts a developer can leverage as a means of managing your codebase to promote modularity and reusability, and overall aid in project management. In particular, we will cover:

  • Typescript paths aliases and how they simplify your project structure and import statements. We’ll also cover the fallbacks of using paths in terms of their support in major frameworks today
  • Alternatives to using paths with your private package registry, and where this would be suited. We will cover the process of configuring a Typescript package, and deploying it to an NPM registry.
  • Multi Package Projects / Monorepos: We’ll cover how a monorepo project is set up in Typescript and the benefits they bring. A monorepo is a project hosted as a repository, that contains a multitude of separate packages that…

--

--

Ross Bulat

Programmer and Author. @ Parity Technologies, JKRB Investments