tsconfig baseUrl and tsgo
2025-06-02
At work we're adopting typescript-native, the go port of typescript. Yay for 10x speed! We quickly found that our paths weren't working and eventually tracked it down to baseUrl being unsupported in typescript-go. And it turns out it'll be deprecated in Typescript 6, the next and last javascript version of typescript.
It seemed like this would be easy, just make our paths relative to the tsconfig file they were in and we'd be back in business. Unfortunately other tooling ts-node relies on tsconfig aliases, but gets them via tsconfig-paths. tsconfig-paths doesn't properly support relative paths in an extended tsconfig. Initially I wrote up a patch for tsconfig-paths so that it would handle relative paths in an extended config. It worked, but then some other piece of our tooling programmatically used typescript to get the same paths. And guess what, typescript itself doesn't properly resolve relative paths if you ask it for your config. It clearly resolves them correctly internally, as it can resolve aliases, but if you tsc --showConfig it will not resolve them correctly.
At work our configs are a bit complicated but imagine a base tsconfig.json and then tsconfig/aliases.json where the base one extends the aliases one and all the paths are in the aliases one. So what did we do, we lifted it up. We now have tsconfig.json and aliases.json in the same directory and everything is happy.
- ← Previous
The Electrocasters of Zuffo 9 - Next →
Cloudflare Email Worker TypeScript