Skip to content

Promise.then should use this return type #6220

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
saschanaz opened this issue Dec 23, 2015 · 4 comments
Closed

Promise.then should use this return type #6220

saschanaz opened this issue Dec 23, 2015 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@saschanaz
Copy link
Contributor

class Subclass<T> extends Promise<T> { }
new Subclass<void>((resolve, reject) => resolve()).then() instanceof Subclass
// true
@weswigham
Copy link
Member

Problem: there's no way to rebind the generic parameters of the this type to match the return type of the function passed to then - and, conceptually, a given subclass may not even be generic.

@kitsonk
Copy link
Contributor

kitsonk commented Dec 23, 2015

I realised that this is directly related to #6223. In a theory, not being able to express some sort of generic resolution of polymorphic this will cause challenges.

@zpdDG4gta8XKpMCd
Copy link

#5999

@mhegazy
Copy link
Contributor

mhegazy commented Feb 19, 2016

see #6223 and #5999

@mhegazy mhegazy closed this as completed Feb 19, 2016
@mhegazy mhegazy added the Duplicate An existing issue was already created label Feb 19, 2016
@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

5 participants