当 TsLint 说“预期 callSignature 有一个 typedef"是什么意思. [英] What does it mean when TsLint says "expected callSignature to have a typedef."

查看:57
本文介绍了当 TsLint 说“预期 callSignature 有一个 typedef"是什么意思.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码中有一个函数:

I have a function in my code:

networkStop = (action: string = null) => {
    this.action[action] = false;
    this.net = false;
    this.netd = false;
}

我收到 TsLint 错误消息:

I'm getting a TsLint error saying:

Message 4   TsLint: expected callSignature to have a typedef.

谁能解释一下这是什么意思?

Can someone explain what this means?

推荐答案

"Missing Type definition" 参见:https://github.com/palantir/tslint/blob/master/src/rules/typedefRule.ts 了解详情.基本上 some 注释(对于函数,因为 callSignature)缺失.

"Missing Type definition" See : https://github.com/palantir/tslint/blob/master/src/rules/typedefRule.ts for details. Basically some annotation (for a function because callSignature) is missing.

可能是修复(明确指定返回类型):

Probably the fix (specify the return type explicitly) :

networkStop = (action: string = null):void => {
    this.action[action] = false;
    this.net = false;
    this.netd = false;
}

这篇关于当 TsLint 说“预期 callSignature 有一个 typedef"是什么意思.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆