Errors with simple declaration file in TS for JQuery Plugin

97 views Asked by At

I'm trying to copy what was done in this link here while making a slight modification. Instead of using daterangepicker, I'm using react-list-nav. However, I still am unable to get my project to "notice" any of the listnav functions, such as $('#demoOne').listnav();

My copy of typings.d.ts is below

interface JQuery {
   "react-list-nav"(options?: any, callback?: Function) : any;
}

In my index.ts I am importing as follows:

import * as rln from "react-list-nav"
// this errors
// $('#demoOne').listnav() 

What am I doing wrong?

1

There are 1 answers

3
Paul Huynh On

You'll want this in your typings.d.ts

declare interface JQuery {
  listnav(options?: any, callback?: any): any
}