Absolute root path for reference / import

Topics: General
Jul 29, 2013 at 4:21 PM
Is it possible to define a root path (e.g. via a compiler flag) from which to define all the reference / import paths in Typescript?

Having to reference everything via relative paths makes for some messing import statements. It also makes moving files around inside your application more difficult as you might have to update every reference in every file you move!
Coordinator
Jul 30, 2013 at 11:55 PM
We've thought about doing this, but not sure how best to fill out the story. For example, if you do it for how import paths work, should we also output a config file for doing the loading, or do we leave that up to the user?

I agree in theory that this would help. It's just like adding an include path. But I'd want to have a pretty clear understanding of just how far the feature goes (and doesn't go).
Jul 31, 2013 at 9:08 AM
Perhap it is possible to manage variables on reference tag, and specify it on compiler options.
Files like this for exemple:
/// <reference path="{pathProjectA}/Foo.ts" />
/// <reference path="{pathProjectB}/Bar.ts" />
with compiler like this:
tsc ... --var pathProjectA=... pathProjectB=...
Coordinator
Aug 1, 2013 at 3:57 PM
@paztis - I like that idea. I'll copy it over to being a suggestion we can track for later.
Coordinator
Aug 1, 2013 at 3:57 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.