0

In order for a JQuery plugin called sliderkit to work I had to add a property in JQuery's interface.

I've added one line in it:

interface JQuery<TElement = HTMLElement> extends Iterable<TElement> {
    sliderkit(options?: any, callback?: Function) : any;

Before doing that I was getting this error:

Property ‘sliderkit’ does not exist on type ‘JQuery’

So I've found this article: Typescript — Integrate jQuery Plugin in your Project and it worked like a charm.

However, the change was done in this file:

/node_monules/@types/jquery/JQuery.d.ts

Which sucks because everytime someone runs npm install it will overwrite the file.

How can I achieve this without changing files inside node_mudules ?

  • After you have done the changes in jquery file, you can remove its reference from package.json file temporarily (until development when you are running npm install). After that you can again add its reference back when you are done with adding dependencies using npm install – Ganesh Sanap May 19 at 13:39
0

I have reviewed the mentioned article, you can create a separated type definition file.

enter image description here

Below is a tutorial about how to add an external library to your SharePoint client-side web part.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.