【发布时间】:2017-01-20 22:11:05
【问题描述】:
当我尝试定义原型函数时,我得到:
错误 TS2339:类型上不存在属性“applyParams” “功能”。
Function.prototype.applyParams = (params: any) => {
this.apply(this, params);
}
如何解决这个错误?
【问题讨论】:
-
试试这个:stackoverflow.com/a/28020863/1142380 我认为你不需要“
prototype.”部分 -
@ToastyMallows 但随后出现错误 TS2339:“FunctionConstructor”类型上不存在属性“applyParams”。即使使用接口 FunctionConstructor { applyParams(params: any): any; }
标签: typescript prototype