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

PromiseLike.then returns PromiseLike<Promise<T>> instead of PromiseLike<T> #17862

Closed
ghost opened this issue Aug 17, 2017 · 2 comments
Closed
Labels
Bug A bug in TypeScript
Milestone

Comments

@ghost
Copy link

ghost commented Aug 17, 2017

TypeScript Version: nightly (2.6.0-dev.20170817)

Code

declare const p: PromiseLike<string>;
const x: PromiseLike<number> = p.then(() => Promise.resolve(1));

Expected behavior:

No error.

Actual behavior:

src/a.ts(2,7): error TS2322: Type 'PromiseLike<Promise<number>>' is not assignable to type 'PromiseLike<number>'.
  Type 'Promise<number>' is not assignable to type 'number'.

Discovered in DefinitelyTyped/types/xadesjs.

@spion
Copy link

spion commented Jan 19, 2018

FYI this is now also happening in mainline TS 2.6.2

@jakebailey
Copy link
Member

Old issue, but this was fixed back in #40002.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants