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

浪尽此生 提交于 2019-12-19 18:56:12

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/28093877/latest-version-of-jquery-for-typescript-is-throwing-syntax-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!