我爲我的服務結果創建了一個TypeScript
接口。現在我想爲裏面的兩個函數定義一個基本的功能。問題是,我得到一個錯誤:在TypeScript中實現接口的原型
The property 'ServiceResult' does not exist on value of type 'Support'.
我用WebStorm
發展(VS2012
讓我很緊張,因爲對大項目凍結 - 等待更好的整合:P)。
這裏是我如何做到這一點:
module Support {
export interface ServiceResult extends Object {
Error?: ServiceError;
Check?(): void;
GetErrorMessage?(): string;
}
}
Support.ServiceResult.prototype.Check =() => {
// (...)
};
Support.ServiceResult.prototype.GetErrorMessage =() => {
// (...)
};
我也試圖在我的原型移動到模塊,但同樣的錯誤還是......(當然我刪除Support.
前綴)。