I’m using the jQuery is() function from here. The documentation says that it returns a bool. In the TypeScript definition file it has the following for the is() function:
is(selector: string): JQuery;
is(func: (index: any) =>any): JQuery;
is(element: any): JQuery;
is(obj: JQuery): JQuery;
Am I correct in saying that I just need to change the return type from JQuery to bool to fix this in the definition file?
The
isdocumentation seems pretty clear that this is the case.I’m not going to try and second guess the developer that wrote the
jquery.d.tsdefinition – it is possible that there is a mistake in the jQuery documentation (it isn’t unknown) – but it is also likely that any jQuery functions that return things other thanJQuerywill have been mistakenly defined that way because most jQuery function do return a jQuery object.I would change the return value to
bool. I will raise a bug on Codeplex, that way the TypeScript team can either fix it or explain it.