Say Goodbye to ‘../../../..’ in your TypeScript Imports

Don’t you hate writing import lines and not being sure how many dot-dot-slashes you need to get to the right place? Sure, you can look over at the project tree but there are so many files that you’ve got to scroll and scroll.

Oh no… Was that '../../../../' or '../../../../../'? [scrolls back down]. It drives me bananas.

Things are even worse if you restructure your project tree and some files move higher or lower. Or you copy-paste import sections between files that are at different levels in the project tree. Now your watch window is a sea of red.

But… it shouldn’t matter if your dependency is up four directories vs. five. Unfortunately, that’s just how module resolution works in Node.js.

Wouldn’t it be great if you could forget about relative paths entirely?

You could have the deepest, most complex project structure… bring it on.

Continue reading “Say Goodbye to ‘../../../..’ in your TypeScript Imports”

Say Goodbye to ‘../../../..’ in your TypeScript Imports