Typescript 模块手册示例未执行

Typescript module handbook sample not executing

我正在尝试在 VS 2015 中进行验证的模块示例,但它编译正常但在执行时出错。

test.ts 手册示例中的文件给出行的执行错误 验证器['ZIP code'] = 新的Validation.ZipCodeValidator();

"Validation"未定义.,这是模块的名称.

在 VS 中,我可以对模块名称使用智能感知,但是在执行它时会给出模块名称错误。

谢谢

"Validation" is undefined., which is the name of module.

一个明确的代码排序问题。 reference 评论乱序(如果您使用 --out)或者您需要修复用于加载文件的 script 标签。