Visual Studio Error List: Ignore JavaScript Link

It is likely how three people do what I do, but here goes:

  • Visual studio 2012
  • Latest Web Sites
  • TypeScript project
  • AngularJS Frame
  • Running Chutzpah tests with Jasmine

When creating tests for Chutzpah, I need to add links not only to my typescript files, but also to the javascript libraries that I use. For instance:

// Typescript References (for tsc)
/// <reference path="../ref/angular-1.0.d.ts" />

// JavaScript references (for chutzpah)
/// <reference path="../lib/angular.min.js" />

// TS references for what we're actually testing...
/// <reference path="../src/modules.ts" />

With this setting, my wash2-waut-heat tests work fine. However, the angular.min.js file fills my list of errors with hundreds of complaints. This makes it impossible to search for errors reported by typescript parsing.

If I remove the link to angular.min.js, then Chutzpah cannot work, since my code depends on the library.

Visual Studio JavaScript?

+5
4

Chutzpah 2.4.

Chutzpah

TypeScript Chutzpah TypeScript VS. , TypeScript, Chutzpah . Chutzpah .

  • /// <reference path="foo.js" />

  • Chutzpah /// <chutzpah_reference path="foo.js" />

Chutzpah TypeScript.

+3

, .js .
.ts .

.js , TypeScript TypeScript, , .
DefinetelyTyped angular.min.js angular.d.ts, TypeScript.

0

, , /// . , Resharper javascript.

The solution (though not perfect) is based on a discussion at http://typescript.codeplex.com/workitem/466 . Starting with version 9.1.1 typescript, the compiler ignores links that contain a space after the '='. So instead of using

/// <reference path="~/somefile.js"/>

Instead, you use:

/// <reference path= "~/somefile.js"/>

Beware: this may break in future versions of typescript, but hopefully by then the language will support a way to include links to javascript files that the compiler ignores.

0
source

All Articles