I'm using Visual Studio 2015, and I have a project that uses Typescript 1.6.3 and JQuery. The problem is that the
JQuery.data(key: string): any;
function should return any, but if I have a JQuery variable named "element" and I write:
element.data('field')
the Intellisense keeps saying the function returns JQuery instead of any. Also, it says the currently used overload is
JQuery.data(obj: { [key: string]: any; }): JQuery;
and not the one that accepts a simple string.
Am I missing something or is it known bug?
You need to get an up-to-date version of jquery.d.ts from DefinitelyTyped. There was a change in the TypeScript compiler (https://github.com/Microsoft/TypeScript/issues/4619) that exposed an incorrect definition in the .d.ts file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With