我正在尝试为Angular2和SystemJs建立一个构建环境,这样我就可以从外部库中导入组件,这些库的定义如下:
@Component({
moduleId: __moduleName,
selector: 'foo-selector',
templateUrl: 'foo.component.html'
})
我确信这是我想要使用的,因为它在我运行它时起作用。但是,Typescript编译失败,因为它无法识别moduleName
。我如何告诉打字稿识别这个,或者至少不要抱怨它?
这是使用Typescript版本2.1.0-dev.20160915而module
设置为system
中的tsconfig.json
答案 0 :(得分:2)
您可以尝试将此行添加到typings/index.d.ts
文件中:
declare var __moduleName: string;