Trying to wrangle jQuery UI into a Typescript 2.6.2 project that already has jQuery working nicely, but running into a brick wall. Compiles fine but at runtime I get this:
Exception has occurred: ReferenceError
ReferenceError: jQuery is not defined
Here is my main.ts file:
import $ = require('jquery');
import "jqueryui";
$(document).ready(() =>
{
$( "#slider" ).slider( {
orientation: "vertical",
min: 0,
max: 150,
value: 50
} );
});
Here is the index.html file:
<!doctype html>
<html>
<head>
<script src="./bundle.js"></script>
</head>
<body>
<div id="slider"></div>
</body>
</html>
For reference, here are my tsconfig.json, package.json, and the command line I use to transpile to JavaScript:
tsconfig.json:
{
"compilerOptions":
{
"target": "es2015",
"module": "commonjs",
"moduleResolution":"node"
},
"include":
[
"spec/*.ts"
]
}
package.json:
{
"name": "tsbugger",
"version": "0.0.1",
"description": "debug config test",
"main": "index.js",
"scripts": {
"test": "jasmine"
},
"repository": {
"type": "git",
"url": ".git"
},
"author": "",
"license": "ISC",
"dependencies": {
"@types/jasmine": "^2.8.6",
"@types/jquery": "^3.3.0",
"@types/jqueryui": "^1.12.2",
"browserify": "^15.2.0",
"jasmine": "^2.9.0",
"jquery": "^3.3.1",
"jqueryui": "^1.11.1",
"tsify": "^3.0.4",
"typescript": "^2.6.2"
}
}
build command:
browserify main.ts --debug -p tsify 1>bundle.js
How can I get jQuery UI working in Typescript with proper typings?