[英]ESLint rule for arrow function requiring return type
我的 angular 項目中有以下箭頭 function :
this.httpClient.get('url').subscribe((response)=>{
});
在上面的代碼中,ESLint 應該會因為未指定返回類型而引發錯誤。
檢查規則@typescript-eslint/explicit-function-return-type 。 您需要將選項allowTypedFunctionExpressions
設置為false
。 如果你使用.eslintrc:
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowTypedFunctionExpressions": false
}
]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.