为什么打字稿编译器以Hash字符开头的.TS文件上默默退出



如果我编译以下文件

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;
})();

这里是怎么回事?

这已固定在开发人员分支(0.8)上。字符,例如 @或#不再阻止汇编。请检查最新的编译器。

这只是一个错误。正如您所期望的那样,这应该是一个错误。

最新更新