General problems with<reference> includes

Topics: General
Nov 20, 2012 at 2:26 PM
Edited Nov 20, 2012 at 2:27 PM

Hi,

The reference includes mechanism is somewhat faulty and undermines confidence in the type system - in the sense that one cannot be certain that all compilation errors have been correctly identified when multiple projects are built concurrently.

Here are a some of the issues:

Silent fails

Incorrect syntax in the path fails silently in the following circumstances, instead of displaying the red squiggly line:

  • Omitting closing slash ("/") in "/// <reference path="file.ts" />"
  • When the quotes (") around the path are missing
  • When the path specifies ".../MyFolder" instead of "../MyFolder" 
  • When a ".js" extension is accidentally used instead of ".ts" 
  • Space after path: path = "file.ts" does not work (although this doesn't seem to happen consistently)

Build issues

  • If a referenced file is renamed, then projects containing a reference to that file continue to build successfully in spite of the invalid reference.
  • Invalid reference paths are sometimes only highlighted when the file containing the invalid reference opened.

General usability issues

  • The editing of the path is a bit sticky. When an incorrect path is typed in and immediately corrected, the compiler continues to refer to the old path, and in order to force the new path to be recognised it is sometimes necessary to close and reopen the file.
  • The speed of detection is also rather slow; one finds oneself making an edit and then staring expectantly at the screen waiting to see if something is going to materialise.

 

The <reference> include mechanism feels like a leftover from the old JavaScript intellisense system, and TypeScript seems to need something shiny and new - and robust.

Please advise.

Thanks.

Noel

Coordinator
Nov 20, 2012 at 3:46 PM

Thanks for the in-depth analysis.  I'm going to copy this over to the issue tracker so we can track them there (and may get split up further).

Coordinator
Nov 20, 2012 at 3:46 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.