So I'm trying to use JQueryUI with TypeScript and so far I've installed JQueryUI with npm install jquery-ui-dist
and JQuery with npm install jquery
. I've also added the definition files from DefinitelyTyped with npm install --save-dev @types/jquery
and npm install --save-dev @types/jquery-ui
.
I've got the following file (some parts omitted):
///<reference path=../../node_modules/@types/jqueryui/index.d.ts/>
import * as $ from jquery;
import jquery-ui;
export default class Resizer {
public static extraMargin = 5;
public static setVerticalResizer(...) {
...
let topElem: HTMLElement = <HTMLElement> cardElem.querySelector(.my-class);
$(topElem).resizable({
...
});
}
}
And upon building and running I get the following error:
Uncaught TypeError: r(...).resizable is not a function
So I guess there's some problem with my way of importing JQueryUI? Or maybe JQueryUI was not installed correctly? Although the import and definitions seem to be working correctly in VS Code.
This is also how I'm using them in the HTML file:
<script src=node_modules/jquery-ui-dist/jquery-ui.mis.js></script>
<link rel=stylesheet href=node_modules/jquery-ui-dist/jquery-ui.min.css>
Any ideas on how to solve the problem and use JQueryUI with TypeScript?