Can not resolve directory for typescript reference path

The following entry

/// <reference path="/Users/roger/Documents/DefinitelyTyped/angularjs/angular.d.ts"/>

gives me some red markes in my ts file. For every parth of the path I get get e.g. 'Can not resolve directory "roger".

Code completion and tsc compiling works.

Regards
  Roger

3 comments
Comment actions Permalink

Do you use the absolute path to .d.ts? The IDE expects the path relative to current file here (per spec:

"A  comment of the form /// <reference path="…"/> adds a dependency  on the source file specified in the path argument. The path is resolved  relative to the directory of the containing source file"

Though the compiler seems to accept absolute paths, the IDE won't find the file using it
I'd suggest to put these .d.ts files into your module folder and change paths to relative - they will be available to both Idea typescript parser and ts compiler configured as a file  watcher, and no errors will be reported

0
Comment actions Permalink

Using relative pathes solved the problem in 13.02. But it is broken in 13.1. Intellij expects now

/// <reference path='../../DefinitelyTyped/angularjs/angular.d.ts'/>   => relative from project dir

but the tsc compiler wants

/// <reference path='../../../../DefinitelyTyped/angularjs/angular.d.ts'/>   => relative from file dir

Regards
  Roger

0
Comment actions Permalink

Setting the scripts folder as the source folder solved the problem.

Regards
  Roger

0

Please sign in to leave a comment.