I just started using TypeScript and I made 2 files, lib.ts and main.ts, and picked AMD modules during compilation. The compiler generates one file with definitions but it doesn't actually call any function to execute. The contents of the main.ts file are just wrapped inside a module. Here are the files:
lib.ts
export namespace Library {
export class Write {
constructor() {
console.log("hello world");
}
}
}
main.ts
import {Library} from "./lib";
new Library.Write();
The compiler command:
tsc main.ts --outFile out.js --module amd
out.js
define("lib", ["require", "exports"], function (require, exports) {
"use strict";
var Library;
(function (Library) {
var Write = (function () {
function Write() {
console.log("hello world");
}
return Write;
}());
Library.Write = Write;
})(Library = exports.Library || (exports.Library = {}));
});
define("main", ["require", "exports", "lib"], function (require, exports, lib_1) {
"use strict";
new lib_1.Library.Write();
});
How can I get the compiler to actually generate code that executes? The documentation does not help.