3
  1. I created a new TypeScript project.
  2. Created a folder called types
  3. Downloaded jquery.d.ts from https://github.com/borisyankov/DefinitelyTyped/tree/master/jquery and placed it in the folder.

If I create a new TypeScript file and drag jquery.d.ts onto the document, such that the only thing at the top of the page is.

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

I get 101 Errors. Starting from the top of jquery.d.ts - VS has a problem with boolean in the async?: boolean; line.

interface JQueryAjaxSettings {
accepts?: any;
async?: boolean; 

What am I doing wrong here, I'm assuming that jquery.d.ts has some form of dependency, but I don't know where to start?

4

2 回答 2

1

The most likely cause of this error is that you are running an older version of the TypeScript compiler.

In TypeScript 0.9 the language specification was updated from bool to boolean. This means boolean will only compiler in 0.9+. If you have a 0.8 compiler, it won't understand what a boolean is.

You can either upgrade to the latest compiler, or check the version history on GitHub for jQuery.d.ts to find an old version with bool rather than boolean.

于 2013-11-05T12:59:29.813 回答
0

Couple of things to check

  • Update your typings module
  • Similar modules trying to do the same thing like core-js and es6-shim
  • There may be other files in your root directory having typings installed, Check for them and remove. Check where the error is pointing, your clue is there.

    Have all your typing in the typings folder and configure it in your package.json . So when you install your project dependencies through npm install all your typings too get installed

"scripts":{
     "postinstall": "typings install"
}
于 2016-12-07T10:34:17.190 回答