镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions