Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • The errors will not appear right away, only after a certain (seemingly random) amount of time.
  • They will usually be triggered on saving a file.
  • They are things like:

    "All named properties must be subtypes of string indexer type 'any'"

  • Removing any .ts file from the project or restarting VS will make them go away for a time, but they will always come back.
  • The compiler still runs, and all .js files are generated correctly.

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?

like image 967
user888734 Avatar asked Nov 12 '22 21:11

user888734


1 Answers

Go to visualstudiogallery

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

like image 169
Nikos Tsokos Avatar answered Nov 15 '22 08:11

Nikos Tsokos