Skip to content

Type checking not behaving as expected for Promise<T> signatures #10524

@jonnycornwell

Description

@jonnycornwell

TypeScript Version: 2.0.0@beta && 2.1.0-dev.20160824

Code

var fooPromiseLike: PromiseLike<string>;
var fooPromise: Promise<string>;
var bar: (f: PromiseLike<boolean>) => void;

// Errors with PromiseLike<string> is not assignable to PromiseLike<boolean>
bar(fooPromiseLike);

// Should also error?
bar(fooPromise);

Expected behavior:

Should give an error when passed an incorrect signature, works as expected in 1.8.10. Unless I am missing something?

I couldn't find any open issues related to this and it seems to still be broken in the nightly build

Metadata

Metadata

Assignees

Labels

FixedA PR has been merged for this issueIn DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions