Typescript error when declare function, that returns promise to Derivable.
- Dominant language
- JavaScript
- Stars
- 518
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
I cant declare function, that returns promise to [Derivable](https://ds300.github.io/derivablejs/#derivable-Derivable). Reason is next:
[Minimal exmaple in playground](https://www.typescriptlang.org/play/#src=interface%20Some%20%7B%0D%0A%20%20then(callback)%3B%0D%0A%7D%0D%0A%0D%0Aasync%20function%20foo()%3A%20Promise%3CSome%3E%20%7B%0D%0A%20%20return%20null%3B%0D%0A%7D%0D%0A%0D%0Aasync%20function%20ok()%3A%20Promise%3Cnumber%3E%20%7B%0D%0A%20%20return%2042%3B%0D%0A%7D)
interface Some {
then(callback);
}
// Error: the return type of an async function must either be a valid promise or must not contain a callable 'then' member.
async function foo(): Promise {
return null;
}
[StackOverflow question](https://stackoverflow.com/questions/47111363/typescript-error-when-function-return-type-is-promise-then-void)
Because of that I can't use async/await.
Looks like we should rename `then` method to `chain`
Contributor guide
Assessment
This issue has not been assessed yet.