Skip to content

Fix 'extends' with type parameter default returned from superclass construct signature #16502

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

Merged
merged 3 commits into from
Jun 14, 2017

Conversation

rbuckton
Copy link
Contributor

This fixes an issue with extends where the instantiation of a class-like "constructor" function used as a base class fails when the construct signature returns a type parameter default.

This also fixes an issue where we were not reporting a grammar error for an empty type argument list in a heritage clause.

Fixes #16211

@rbuckton rbuckton requested review from yuit and ahejlsberg June 13, 2017 20:23
@rbuckton rbuckton requested a review from sandersn June 13, 2017 20:25
@rbuckton rbuckton changed the title Fix16211 Fix 'extends' with type parameter default returned from superclass construct signature Jun 13, 2017
@rbuckton rbuckton added this to the TypeScript 2.4.1 milestone Jun 13, 2017
else {
result.push(sig);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nicer to keep it as an expression:

return map(signatures, sig => some(sig.typeParameters) ? getSignatureInstantiation(sig, typeArguments) : sig)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better, use sameMap and save an allocation when none of them need to be instantiated (which is often the case).

else {
result.push(sig);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better, use sameMap and save an allocation when none of them need to be instantiated (which is often the case).

@rbuckton rbuckton merged commit fbe002a into master Jun 14, 2017
@rbuckton
Copy link
Contributor Author

I will port this to release-2.4 tonight.

@rbuckton
Copy link
Contributor Author

This has been ported to release-2.4

@rbuckton rbuckton deleted the fix16211 branch June 14, 2017 04:33
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot extend from type which constructs intersection of type parameter with a default
4 participants