typescript 当 TsLint 说“预期 callSignature 有一个 typedef”是什么意思。
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25459136/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does it mean when TsLint says "expected callSignature to have a typedef."
提问by basarat
I have a function in my code:
我的代码中有一个函数:
networkStop = (action: string = null) => {
this.action[action] = false;
this.net = false;
this.netd = false;
}
I'm getting a TsLint error saying:
我收到 TsLint 错误消息:
Message 4 TsLint: expected callSignature to have a typedef.
Can someone explain what this means?
有人可以解释一下这是什么意思吗?
回答by basarat
"Missing Type definition" See : https://github.com/palantir/tslint/blob/master/src/rules/typedefRule.tsfor details. Basically someannotation (for a function because callSignature
) is missing.
“缺少类型定义”请参阅:https: //github.com/palantir/tslint/blob/master/src/rules/typedefRule.ts了解详情。基本上缺少一些注释(对于函数,因为callSignature
)。
Probably the fix (specify the return type explicitly) :
可能是修复(明确指定返回类型):
networkStop = (action: string = null):void => {
this.action[action] = false;
this.net = false;
this.netd = false;
}