google / google/closure-compiler

The return type of an async function must be a supertype of Promise

Open
#3,328 4 comments 0 reactions 0 assignees View on GitHub
internal-issue-created triage-done
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

If a class extends another class where a certain function is sync, with an async function, there will be a warning.

```js
class B {
_transform() {
console.log('sorry not sorry')
}
}

class A extends B {
async _transform() {
console.log('good morning my neighbours')
}
}

class C {
async _transform() {
console.log('google closure compiler rules')
}
}

new A()._transform()
new C()._transform()
```

```sh
t/async.js:8: WARNING - The return type of an async function must be a supertype of Promise
found: undefined
async _transform() {
^^^^^^^^^^^^^^
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.