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

TypeScript 2.1.4 - error compiling async/await with Promises typed as this #12910

Closed
ryanwe opened this issue Dec 14, 2016 · 1 comment · Fixed by #13487
Closed

TypeScript 2.1.4 - error compiling async/await with Promises typed as this #12910

ryanwe opened this issue Dec 14, 2016 · 1 comment · Fixed by #13487
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@ryanwe
Copy link

ryanwe commented Dec 14, 2016

TypeScript Version: 2.1.4

Code

interface Bar extends Promise<void> {
    foo(): this;
    // also repros with `foo(): Bar;`
}

const buggy = async (param: Bar) => {
    await param.foo();
};

Expected behavior:
In TypeScript 2.0.3 this code will compile successfully.

Actual behavior:
In TypeScript 2.1.4 this code will not compile successfully and gives the error error TS1058: Operand for 'await' does not have a valid callable 'then' member.

@mhegazy mhegazy added the Bug A bug in TypeScript label Dec 14, 2016
@mhegazy mhegazy added this to the TypeScript 2.2 milestone Dec 14, 2016
@nevir
Copy link

nevir commented Dec 30, 2016

FWIW, this crops up for the knex typings, too.
(QueryBuilder implements ChainableInterface implements Promise<any>)

No explicit this references, but lots of self references to QueryBuilder

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Feb 15, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants