user888734
user888734

Reputation: 3897

100+ errors in lib.d.ts with TypeScript in Visual Studio

I have a small-ish MVC4 web app using TypeScript for the clientside (~40 .ts files).

When I upgraded TS to 0.9.1.1, I now see 100+ errors in lib.d.ts appearing the error list in Visual Studio 2012.

The problem is unavoidable (all members of our team got the same thing when they upgraded), but literally impossible to reliably reproduce. Some behaviours:

I have tried setting up a new empty project, in both VS2012 and VS2013 RC, then started adding our TS classes one by one. At some point, the errors will appear, but retracing steps has proved completely fruitless in identifying what might kick it off. However, it does seem to only happen as you approach 15-20 .ts files.

I'm at my wits end here.

PS. In the error list, the under the "Project" column, it often names a particular file, rather than a project. Quite often it's a definitions file, e.g. underscore.d.ts. Why would this be named as a Project?

EDIT:

I've managed to recreate this with a single .ts file and a handful of definition files.

App.ts

module Application {
    export class Main {
        constructor(options?) {
        }
    }
}

In addition to most recent versions of:

backbone.d.ts
jquery.d.ts
underscore.d.ts
backbone.relational.d.ts

I made many rapid changes and saves to App.ts to reproduce i.e. ~10 in 5 seconds. Could this suggest a file permissions error?

Upvotes: 5

Views: 1539

Answers (2)

Nikos Tsokos
Nikos Tsokos

Reputation: 3356

Go to visualstudiogallery

and make sure you have the latest version of typescript installed.

Upvotes: 1

basarat
basarat

Reputation: 276239

It seems that it is because of optimisations done in typescript language services. Visual studio tries to partially update the information for analysis, but once analysis lags, behind update commands this happens.

A temp fix is to cut the entire contents of the file, and paste them back, this gives the language service a fresh view of the file.

Upvotes: 0

Related Questions