Search code examples
typescriptlernapnpm

Is there a mono repo library which allows us to use typescript packages with type suggestions without compiling?


Let's say I have a mono repo like this:

repo
 |--- package1
 |--- package2

Both packages are written in TypeScript. I need to use package1 inside package2. Currently I'm using lerna (Planning to switch to pnpm) and if I want to use package1 inside any other package, I first have to build it and generate the index.d.ts type definition file in order to get type completion wherever I use it. It would be really great If I can do this without compilation so that during the development, I can easily keep working without re building package1 every time I update it. At the moment, I have a watcher set for this which takes a lot of resources from my machine.


Solution

  • You may want to considering typescript references https://www.typescriptlang.org/docs/handbook/project-references.html