The property 'jqGrid' does not exist on value of type 'JQuery'

I am using Typescript with jqGrid and jQuery.

On the following line:

jQuery(this).jqGrid('editGridRow', rowid, {

I get the message:

The property 'jqGrid' does not exist on value of type 'JQuery'.

Any ideas on how to correct this problem?


I suppose that you use jquery.TypeScript.DefinetlyTyped NuGet Package.

In that case add file ~/Scripts/typings/custom.d.ts with following content:

/// <reference path="jquery/jquery.d.ts"/>
interface JQuery { jqGrid: any; }

Update: Above solution is general and works in all cases. Better solution is to...

Install jqgrid.TypeScript.DefinitelyTyped NuGet Package.

The problem is that JQuery grid is a plugin. It seems like you have a definition file for the JQuery library but not for the JQuery Grid plugin. I checked on and there does not appear to be a type definition for this particular plugin. There are a few things you could do.

  • You could assign jQuery to a variable of "any" type:

var localJq : any = jQuery(this); localJq.jqGrid('editGridRow', rowid, { ... });

This will fool the compiler and let you access properties on the var that are not defined in a definition file.

  • You could create a definition file which adds the jqGrid properties to jquery. This definition file needs to be referenced in any typescript files where you are using jqGrid. Here is an example of a definition file for a simple JQuery plugin. As you can see, it is easy to extend the JQuery definition with additional properties.


 ? Trying to convert JQuery plugin to TypeScript
 ? Cannot extend angularjs controller in typescript
 ? Angular2 routing : redirectTo a relative url
 ? Angular 2 - Check current active route "name"
 ? Manually changing the route parameters leads to inconsistent user interface
 ? knockout - trying to use data from 2 data sets in my view
 ? PostgreSQL: Converting data file string to epoch time
 ? PyQT5 and Python3 "exit(a.exec_())" NameError: name 'a' is not defined
 ? Interfaces in Class Files
 ? Static map in class - public or private?