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

Generics with 'extends' for return types cause type check failure. #13993

Closed
na-o-ys opened this issue Feb 10, 2017 · 2 comments
Closed

Generics with 'extends' for return types cause type check failure. #13993

na-o-ys opened this issue Feb 10, 2017 · 2 comments
Labels
Fixed A PR has been merged for this issue Needs Investigation This issue needs a team member to investigate its status.

Comments

@na-o-ys
Copy link

na-o-ys commented Feb 10, 2017

TypeScript Version: 2.2.0

Code

interface I { attr: string }

type M = <T extends I>() => T
const v: M = () => ({})

v().attr

Expected behavior:

Type '() => {}' is not assignable to type 'M'. Type '{}' is not assignable to type 'I'.

Actual behavior:

The compilation is successful.

@zpdDG4gta8XKpMCd
Copy link

@RyanCavanaugh is there any chance to fix assignability checks for generic and do it properly? not sure which issue tracks it (there are way to many)

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label May 24, 2017
@ahejlsberg ahejlsberg added the Fixed A PR has been merged for this issue label Aug 15, 2017
@ahejlsberg
Copy link
Member

Fixed by #16368.

@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
Fixed A PR has been merged for this issue Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

No branches or pull requests

4 participants