IntelliJ: Disable "TS80006: This may be converted to an async function."

2.1k Views Asked by At

In WebStorm, How can I disable the warning (aka. "quick-fix"):

TS80006: This may be converted to an async function.

By 'warning' I mean the function name is underlined, and I see the warning text on hover:

Screenshot of the warning, incl. options

I would expect the setting for this warning to be under Settings / Editor / Inspections somewhere, but I can't find it when I search for "async function" or "quick fix" or "inspections".

(I assume this setting is the same or similar in WebStorm and IntelliJ)

E.g. this warning is displayed for a function like:

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

WebStorm suggest to change it to:

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

But I still prefer the .then() variant, as it is better readable for me.

EDIT:

I found the "Editor / Intentions" section after this answer, but after disabling "Convert to async function" the warning still appears:

Screenshot of my "Intentions" setting

Interestingly, after that, "Convert to async function" it is not suggested anymore in the "more actions" menu, but the "suggestion" is still displayed in the code (including the hover box):

Screenshot of the warning after disabling "Convert to async function"

2

There are 2 best solutions below

9
Yaroslavm On
  1. Open WebStorm and go to Settings

  2. In the settings dialog, navigate to Editor

  3. In the search bar at the top of the settings dialog, type This may be converted to an async function

  4. This rule should be present in Intentions tab.

enter image description here

0
kca On

I found a setting that toggles this warning on and off:

Settings / Languages & Frameworks / TypeScript / TypeScript language service / Show suggestions.

This warning apparently comes from the "TypeScript Language Service".

The Show suggestions option seems to be new in version 2023.2.2, according to the probably related issue WEB-62507.

Apparently there isn't a more detailed configuration (e.g. to just disable this one "suggestion", instead of "Show suggestions" in general).