需要 return 类型的箭头函数的 ESLint 规则
ESLint rule for arrow function requiring return type
我的 angular 项目中有以下箭头功能:
this.httpClient.get('url').subscribe((response)=>{
});
在上面的代码中,ESLint 应该会因未指定 return 类型而抛出错误。
检查规则 @typescript-eslint/explicit-function-return-type。您需要将选项 allowTypedFunctionExpressions
设置为 false
。如果您使用的是 .eslintrc:
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowTypedFunctionExpressions": false
}
]
我的 angular 项目中有以下箭头功能:
this.httpClient.get('url').subscribe((response)=>{
});
在上面的代码中,ESLint 应该会因未指定 return 类型而抛出错误。
检查规则 @typescript-eslint/explicit-function-return-type。您需要将选项 allowTypedFunctionExpressions
设置为 false
。如果您使用的是 .eslintrc:
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowTypedFunctionExpressions": false
}
]