Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Await does not work with interface extending Promise #12737

Closed
jsedlacek opened this issue Dec 7, 2016 · 4 comments
Closed

Await does not work with interface extending Promise #12737

jsedlacek opened this issue Dec 7, 2016 · 4 comments
Labels
Fixed A PR has been merged for this issue

Comments

@jsedlacek
Copy link

TypeScript Version: 2.1.4

Code

interface HelloPromise extends Promise<string> {}

function hello() : HelloPromise {
  return Promise.resolve('hello');
}

async function run() {
  await hello();
};

run();

Expected behavior: The code is compiled without errors.

Actual behavior: Following error is reported:

tsc -t es6 --strictNullChecks index.ts
index.ts(8,3): error TS1058: Operand for 'await' does not have a valid callable 'then' member.

You can find the repro code here:
https://github.com/jsedlacek/ts-promise-repro

@jsedlacek
Copy link
Author

Note: This code works in typescript 2.0.4.

@jwbay
Copy link
Contributor

jwbay commented Dec 8, 2016

Duplicate of #12292?

@rbuckton rbuckton added the Fixed A PR has been merged for this issue label Dec 8, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Dec 8, 2016

Fix should be in typescript@next later tonight. Please give it a try and let us know if you are still running into issues.

@jsedlacek
Copy link
Author

Thanks, I can confirm that typescript@next fixes this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants