As I navigate my way through TypeScript, I find myself in need of accessing type definitions for a jQuery project in Visual Studio. The project currently utilizes jquery version 3.2.1, and I'm on the lookout for TypeScript type definitions for it.
After some research online, it seems that the go-to source for these type definitions is located at https://github.com/DefinitelyTyped/DefinitelyTyped
Upon visiting the page, I came across this information:
npm
This is the preferred method and is available for TypeScript 2.0+ users. For instance:
npm install --save-dev @types/node
It appeared straightforward - just run
npm install --save-dev @types/jquery
to fetch the necessary type definition file using npm. However, a thought crossed my mind - what version of jQuery would this type definition file correspond to? Since everyone types the same command irrespective of the jQuery version used, I decided to check the details on the npm site, only to discover something unexpected:
This particular package contains type definitions for jQuery 1.10.x / (http://jquery.com/).
The confusion set in when I noticed that the latest update was dated "Last updated: Sat, 11 Mar 2017 00:13:28 GMT". Why would there be an update to an npm module linked to jQuery 1.10.x in recent times? Shouldn't the latest version of the jQuery type definitions on npm cater to more modern iterations of jQuery, like 2.0 or higher?
My assumptions lean towards considering these type definitions are indeed up-to-date, yet whoever maintains the npm package fails to update the details accurately. To confirm this speculation, I attempted to decipher the version of jQuery the type definitions were intended for by examining the downloaded module. Unfortunately, no definitive answer could be drawn from my inspection.
Hence, here lies my query - how does one acquire TypeScript definitions files designed for a specific version of jQuery, such as 3.2.1?