I've been having trouble getting jQueryUI work properly. Before I tried to add jQueryUI, having jQuery alone worked just fine.
With the code below, I currently get "TypeError: jQuery is not a function(...)" in chrome, which is strange, considering that jquery is marked as a dependency in the require.config file.
The compiling from .ts to .js happens with no errors.
initApp.ts:
/// <reference path="../../../typings/jqueryui/jqueryui.d.ts"/>
import * as jQuery from "jquery"; //Works completely fine
import * as jQueryUI from "jquery-ui"; //Can't even find the module unless
//d.ts file is modified
Compiled to js:
define(["require", "exports", "jquery-ui"], function (require, exports, jQuery) {...}
jqueryui.d.ts:
/// <reference path="../jquery/jquery.d.ts"/>
declare module JQueryUI { <unmodified code>}
//Added this declare
declare module "jquery-ui" {
export = jQuery;
}
Require.config.js:
require.config({
baseUrl: "./components/",
paths: {
"jquery": "./javascripts/lib/jquery-2.1.4",
"jquery-ui": "./javascripts/lib/jquery-ui",
"go": "./javascripts/lib/go-debug"
},
shim: {
"jquery": {
exports: "jQuery",
},
"jquery-ui": {
//exports: "jQuery", //Adding this line doesn't fix the problem
deps: ["jquery"],
}
},
});
require(["./javascripts/initApp"]);
Directory Tree:
typings/
jquery/
jquery.d.ts
jqueryui/
jqueryui.d.ts
web/
components/
javascripts/
lib/
jquery-2.1.4.js
jquery-ui.js
require.js
initApp.js
initApp.ts
require.config.js
Links to full d.ts files:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/jquery/index.d.ts (jquery V3.3)
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/jqueryui/index.d.ts (QueryUI V1.12)
Any help would be greatly appreciated