Skip to content

Convert to async function with decorator #40042

Closed
@ShPelles

Description

@ShPelles

TypeScript Version: 3.9.7

Search Terms: async, codefix, decorator

Code

class Test {
  @Deco()
  test() {
    return fetch('www.typescript.com').then(x => x);
  }
}

function Deco() {
  return (_target, _key, descriptor: PropertyDescriptor) => descriptor;
}

Expected behavior:
After i run the "Convert to async function" codefix, the expcted result is:

  @Deco()
  async test() {
    const x = await fetch('www.typescript.com');
    return x;
  }

Or at least:

@Deco() async test() {

Actual behavior:

  async @Deco() test() {
    const x = await fetch('www.typescript.com');
    return x;
  }

Playground Link: Playground Link

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbol

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions