I am currently in the process of transitioning my jQuery project into a Typescript project. I encountered an issue when attempting to include the jQuery typings from the DefinitelyTyped Github by using the following method:
///<reference path="../../typings/jquery.d.ts"/>
Upon implementation, I received an "Uncaught SyntaxError: Unexpected identifier" on line 27 of the jquery.d.ts file, as shown below:
declare module 'jquery' {
export = jQuery;
}
Despite my efforts in searching for a solution, I have been unsuccessful in resolving this issue. Can anyone provide guidance on what I might be doing wrong?
(I am utilizing WebStorm as my IDE)
EDIT: After following some advice below, I installed the jQuery typings through the npm terminal. However, upon removing the ///reference import, I encountered an error in WebStorm: TS2304 cannot find name '$'. Despite this error, the code still compiles to JavaScript and functions correctly in the browser. It is just frustrating to have these errors appear in the WebStorm console. Is there a specific solution to make WebStorm recognize jQuery?