10

I got the "Definitely Typed" typescript definition file for JQuery and it uses bool instead of 'Boolean'.

This is giving me errors in my typescript project: Cannot find name 'bool'

I changed my version to use Boolean and it works, but it has me confused.

Is Definitely Typed still the place to get typescript definitions? If so, why is it not breaking for everyone else?

Is there a better place to get typescript definitions?

1
  • 2
    You probably have a really old file for a really old version of the compiler Commented Dec 3, 2015 at 22:56

3 Answers 3

17

The correct name to use is boolean, not Boolean.

Definitely Typed is still the correct place to get definitions from.

Where did you get this file? The current version (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jquery/jquery.d.ts) does not use bool anywhere.

Sign up to request clarification or add additional context in comments.

4 Comments

Hmmm. I went to nuget and installed jquery.TypeScript.DefinitelyTyped. I just found npm install tsd -g.... Going to try to switch to getting them all from that.
Weird. Just checked, and somehow I got version 0.0.1. (first version from years ago...) I will update. Thanks!
It seems that installing the angular.TypeScript.DefinitelyType package has a reference to the version 0.0.1 jquery typescript definition package.
It happened to me also. I installed jQuery d.ts from nuget and it has bool references. Replaced entire contents from github
14

This happened to me as well when I first setup Typescript for an AngularJS project.

  1. Go to Manage NuGet Packages for Solution
  2. View the Updates section, you should see jquery.TypeScript.DefinitelyTyped in the list.
  3. Update the package and the compilation errors will go away.

Hope this helps.

1 Comment

This is better than the original answer, given that the link doesn't exist anymore
-1

I got the same problem - a jquery.d.ts file with bool everywhere rather than boolean.

In my case, the jquery.d.ts file came from a Pluralsight course.

The fix for me was to stop using that version, and instead install the nuget package. From the VS Package Manager Console:

install-package jquery.TypeScript.DefinitelyTyped

At time of writing, that's version 3.1.2 which correctly uses boolean, not bool.

(Also, regarding the Pluralsight course, I didn't use their supplied knockout files, but instead, installed knockout.TypeScript.DefinitelyTyped.)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.