IntelliJ:禁用“TS80006:这可能会转换为异步函数。”

问题描述 投票:0回答:0

在 WebStorm 中,如何禁用警告(又名“快速修复”):

TS80006: This may be converted to an async function.

我希望此警告的设置位于

Settings / Editor / Inspections
下的某处,但当我搜索“异步函数”或“快速修复”或“检查”时找不到它。

(我假设这个设置在WebStorm和IntelliJ中是相同或相似的)

例如对于如下函数会显示此警告:

const f = (): Promise<string[]> => {
  return util()
    .then( mapFunction1 )
    .then( mapFunction2 );
};

WebStorm建议改为:

const f = async (): Promise<string[]> => {
  const s = await util();
  const s_1 = await mapFunction1( s );
  return mapFunction2( s_1 );
};

但我仍然更喜欢

.then()
变体,因为它对我来说可读性更好。

eslint webstorm intellij-14
© www.soinside.com 2019 - 2024. All rights reserved.