daniel
daniel

Reputation: 35733

Typescript definition breeze.d.ts - declare modifier not allowed for code already in an ambient context

Suddenly VS2012 stopped building javascript files from my typescript files. Options look ok. Also tried do uninstall web essentials without success.

Only when I completely restart VS the JS files are generated.

Edit1: seems that breeze.d.ts makes the problems. I am getting the error as soon as i reference it:

/typings/breeze/breeze.d.ts(213,5): error TS1038: 'declare' modifier not allowed for code already in an ambient context.

Edit2: also seems that typescript has still (v0.9) many bugs concerning references and paths. For example you can't use spaces as you want

right:

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

wrong:

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

Upvotes: 2

Views: 3076

Answers (2)

jmunsch
jmunsch

Reputation: 24099

I was able to get over this error by deleting a semicolon:

declare module 'asdf' {
}; 

 ^ deleted the above semicolon

Upvotes: 0

thomaux
thomaux

Reputation: 19738

The error you're receiving is caused by the fact the declare statement is used in the Breeze definition file, which isn't allowed. Definition files do not require the use of the declarestatement to declare variables, modules or interfaces.

I've encountered similar behaviour where an error in one of my referred definition files caused Visual Studio to stop compiling TypeScript without throwing an error. I'm not sure if this is an error on the part of Web Essentials or the TypeScript compiler.

Upvotes: 2

Related Questions