我的代码中有一个函数:
networkStop = (action: string = null) => {
this.action[action] = false;
this.net = false;
this.netd = false;
}
我收到 TsLint 错误消息:
Message 4 TsLint: expected callSignature to have a typedef.
有人可以解释这是什么意思吗?
我的代码中有一个函数:
networkStop = (action: string = null) => {
this.action[action] = false;
this.net = false;
this.netd = false;
}
我收到 TsLint 错误消息:
Message 4 TsLint: expected callSignature to have a typedef.
有人可以解释这是什么意思吗?
“缺少类型定义”详见:https ://github.com/palantir/tslint/blob/master/src/rules/typedefRule.ts 。基本上缺少一些注释(对于函数,因为)。callSignature
可能是修复(明确指定返回类型):
networkStop = (action: string = null):void => {
this.action[action] = false;
this.net = false;
this.netd = false;
}
避免构建错误。在tslint.json 文件中编写如下代码:-
"typedef": [
false,
"call-signature"
],
tslint.json 中的这行代码并不要求方法的返回类型。