【发布时间】:2016-02-20 21:33:46
【问题描述】:
我正在尝试从一些打字稿开始。这就是我的样子:
declare module ServiceActions {
export class MyClass{
myFunction(shipmentId: number) : void {
let test: number;
test = 32;
}
}
}
当我这样做时,我得到了这个错误:
不能在环境上下文中声明实现。
当我取出模块时,它工作正常:
export class MyClass{
myFunction(shipmentId: number) : void {
let test: number;
test = 32;
}
}
我以为我读到模块就像 Typescript 中的命名空间,但这似乎使它更像是一个抽象/接口概念。
我真的因为模块而收到此错误吗?如果不是,为什么会出现这个错误?
注意:我看到了这个question and answer,它没有回答我的问题。
【问题讨论】:
标签: typescript