29 typescript
我的代码中有一个函数:
networkStop = (action: string = null) => {
this.action[action] = false;
this.net = false;
this.netd = false;
}
Run Code Online (Sandbox Code Playgroud)
我收到一个TsLint错误说:
Message 4 TsLint: expected callSignature to have a typedef.
Run Code Online (Sandbox Code Playgroud)
有人可以解释这意味着什么吗?
bas*_*rat 27
"缺少类型定义"请参阅: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;
}
Run Code Online (Sandbox Code Playgroud)
Sha*_*dit 19
避免构建错误。在tslint.json 文件中编写如下代码:-
"typedef": [
false,
"call-signature"
],
Run Code Online (Sandbox Code Playgroud)
tslint.json 中的这行代码没有使方法的返回类型成为必需。
| 归档时间: |
|
| 查看次数: |
21575 次 |
| 最近记录: |