Sergio
Sergio

Reputation: 2108

Visual Studio 2015 + TypeScript 1.6.3 + JQuery

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?

Upvotes: 3

Views: 368

Answers (1)

Ryan Cavanaugh
Ryan Cavanaugh

Reputation: 221004

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.

Upvotes: 2

Related Questions