考虑一个带有打字稿代码的文件(例如:uid.ts):
module uid {
var id = 1;
export class Uid {
value: number;
constructor() {
this.value = id++;
}
}
}
module uid_generator {
import Uid = uid.Uid;
function generate(): Uid {
return new Uid();
}
}
当尝试编译此文件(node.js,编译器版本0.9.0.1)时,我收到以下错误:
$ tsc uid.ts
${HOME}/uid.ts(14,3): error TS2072: Module cannot be aliased to a non-module type.
${HOME}/uid.ts(17,16): error TS2083: Invalid 'new' expression.
根据我的理解,通过阅读语言规范的第10.3节“导入声明”,这应该是在模块'uid_generator'中为类'Uid'创建别名的正确方法。我做错了什么?