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

Wrong type when creating an instance from a type which inherits from a generic class #6783

Closed
stephanedr opened this issue Feb 1, 2016 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@stephanedr
Copy link

The following code is fine:

function create<T>(ctor: { new (): T }) {
    return new ctor();
}

class A { }
class B<T> extends A { }
let b = create(B); // b: B<any> --> OK

But if A is generic, the type is not correct.

class A<T> { }
class B<T> extends A<T> { }
let b = create(B); // b: A<any> --> Should be B<any>

Sorry if this has already been reported.

@sandersn
Copy link
Member

Fixed by #8713.

@sandersn sandersn added the Fixed A PR has been merged for this issue label May 23, 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
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants