TypeScript: workaround for relative reference path?

505 views Asked by At

My goal is to refer to .d.ts files that I've installed with tsd. The tsd definitions GitHub repository has examples using paths relative to the source file's location:

/// <reference path="../typings/tsd.d.ts" />

I find that a potential maintenance issue - if I want to reorganize how my project is organized, I'm going to have to update those references manually in every single file!

I'm wondering if there's a workaround for this? Possibilities would include references which are relative to the project root, or automatic discovery of tsd typings in parent directories.

1

There are 1 answers

1
basarat On BEST ANSWER

I'm wondering if there's a workaround for this

Yes. Use a tsconfig.json file : https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md With that you don't need reference comments.