I am having a tough figuring out how to mix RequireJs and TypeScript. I am compiling TypeScript with the AMD option. The problem is, the function declared within an exported class is classified as "prototype". Is this normal?
ModalHelper.ts:
export class ModalHelper {
saySomething = (something: String) => {
alert(something);
}
}
Compiled ModalHelper.js:
define(["require", "exports"], function (require, exports) {
var ModalHelper = (function () {
function ModalHelper() {
this.saySomething = function (something) {
alert(something);
};
}
return ModalHelper;
})();
exports.ModalHelper = ModalHelper;
});
Create.ts and Create.js (module is marked as required):
require(["jquery", "Shared/ModalHelper"], function ($, modal) {
$(function () {
modal.ModalHelper.saySomething("hi");
});
});
Why am I not able to call this function? From debugging, I see the module being added via RequireJs.