次のファイルをコンパイルすると
test.ts
#
class Test {
}
と
tsc test.ts
出力ファイルは生成されず、コンパイラーは警告やエラーを出しません。デバッグをオンにしてコンパイラを実行する
tsc --debug test.ts
次の出力が生成されます。
Reading code from /usr/local/share/npm/lib/node_modules/typescript/bin/lib.d.ts
Found code at /usr/local/share/npm/lib/node_modules/typescript/bin/lib.d.ts
Reading code from /tmp/ts/directives/test.ts
Found code at /tmp/ts/directives/test.ts
クラス宣言の後にハッシュ行を置くと
test2.ts
class Test {
}
#
コンパイラはエラーを報告せず、出力ファイルを生成します
test2.js
var Test = (function () {
function Test() { }
return Test;
})();
何が起きてる?