Currently, I'm attempting to incorporate JQueryUI with TypeScript by first installing JQueryUI using npm install jquery-ui-dist
, and then installing JQuery with npm install jquery
. Additionally, I have included the definition files from DefinitelyTyped using
npm install --save-dev @types/jquery
and npm install --save-dev @types/jquery-ui
.
The code snippet below showcases a part of my file (some sections are excluded):
///<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({
...
});
}
}
After building and running the code, an error message surfaces:
Uncaught TypeError: r(...).resizable is not a function
It seems like there might be an issue in how I am importing JQueryUI or possibly an incorrect installation of JQueryUI. However, everything appears to import and define correctly within VS Code.
In the HTML file, this is the method I use:
<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 suggestions on resolving this problem and successfully integrating JQueryUI with TypeScript?