Skip to content

Conversation

@yonran
Copy link

@yonran yonran commented Aug 18, 2021

Previously, async-await.js would convert a getter/setter into an invalid async getter/setter.

Input:

class A {
  method() {return a().then(b => 'convert')}
  get prop() {return a().then(b => 'getter')}
  set prop(val) {return a(val).then(b => 'setter')}
}

Output before this PR: async get and async set methods are created, but this is invalid ECMAScript and invalid TypeScript:

class A {
  async method() {
    const b = await a();
    return 'convert';
  }
  async get prop() {
    const b = await a();
    return 'getter';
  }
  async set prop(val) {
    const b = await a(val);
    return 'setter';
  }
}

Output after this PR: get and set methods are not converted to async.

class A {
  async method() {
    const b = await a();
    return 'convert';
  }
  get prop() {return a().then(b => 'getter')}
  set prop(val) {return a(val).then(b => 'setter')}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant