Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latest version of jQuery for TypeScript is throwing syntax errors? [duplicate]

I am almost 100% sure I am doing something wrong to cause this as I am incredibly new to TypeScript and have been updating an old codebase.

When I update jQuery to the latest version I get the following errors when I try and build my project using grunt.

/jquery/jquery.d.ts(279,40): error TS1005: ',' expected.

/jquery/jquery.d.ts(279,61): error TS1005: '=' expected.

/jquery/jquery.d.ts(279,64): error TS1003: Identifier expected.

/jquery/jquery.d.ts(279,97): error TS1005: ',' expected.

/jquery/jquery.d.ts(279,118): error TS1005: '=' expected.

I have shortened the paths and not given every single line, but there are a lot of them.

I am building this using grunt-ts and it seems to be using tsc v1.0.1 – I am unsure where this would be set I am just going by the output when it attempts to build.

like image 895
Toby Avatar asked Jan 22 '15 16:01

Toby


1 Answers

The new version of the jquery.d.ts file uses syntax that is new to TypeScript 1.4. Either upgrade your compiler or downgrade to an earlier version of the .d.ts file[0]. There's a "1.3" branch on DefinitelyTyped specifically for pre-1.4-compatible .d.ts files.

[0] https://github.com/borisyankov/DefinitelyTyped/blob/1.3.0/jquery/jquery.d.ts

like image 67
Ryan Cavanaugh Avatar answered Nov 02 '22 08:11

Ryan Cavanaugh