Skip to content

Chaining a Function that Returns Promise<any> Results in Incorrect Type #12763

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

Closed
ChrisGrohHS opened this issue Dec 8, 2016 · 1 comment
Closed
Labels
Duplicate An existing issue was already created

Comments

@ChrisGrohHS
Copy link

ChrisGrohHS commented Dec 8, 2016

TypeScript Version: 2.1.4

Code

declare function loadBlob(): Promise<Blob>;
declare function readBlobAsJson(blob: Blob): Promise<any>;

loadBlob().then(readBlobAsJson).then(d => {
    d.x// d is Type Blob here
});

Expected behavior:
Compiles without error

Actual behavior:
Property 'x' does not exist on type 'Blob'.

This works without error if an explicit type is set on readBlobAsJson instead of any. Compiled without error in 2.0.6

@Alexander-Taran
Copy link

duplicate of #10977

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Dec 13, 2016
@mhegazy mhegazy closed this as completed Apr 21, 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
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants