簡體   English   中英

需要返回類型的箭頭 function 的 ESLint 規則

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM