#How to use ts path alias in monorepo

3 messages · Page 1 of 1 (latest)

fallow notch
#

I'd like to set up a monorepo where each package can use the path alias "~/*": ["./src/*"]

I've configured a test repo with turbo repo using path aliases that has only two packages at https://github.com/elliotnash/ts-import
however, while everything works fine with imports at runtime (I have a function imported from the package that uses the path alias that runs successfully), the types from packages that use path aliases resolve to any

GitHub

Contribute to elliotnash/ts-import development by creating an account on GitHub.

#

Basically, my test repo is structured so

  1. packages/models (@repo/models) has an index.ts and a models.ts which both have a test function and a test type.

index.ts imports and rexports everything from models.ts using the specifier with a path alias ~/models

  1. apps/app (@repo/app) has an index.ts which calls all the test functions and creates test types