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

Inheriting constructor through extends clause with a wrapped type argument does not work #1424

Closed
JsonFreeman opened this issue Dec 10, 2014 · 4 comments · Fixed by #2824
Closed
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@JsonFreeman
Copy link
Contributor

JsonFreeman commented Dec 10, 2014

The following code should compile just fine, but there is an error when doesNotWork tries to pass this to the constructor for CBase.

class C<T1> extends CBase<T1> {
    public works() {
        new CBaseBase<Wrapper<T1>>(this);
    }
    public doesNotWork() {
        new CBase<T1>(this);
    }

    public method(t: Wrapper<T1>) { }
}

class CBase<T2> extends CBaseBase<Wrapper<T2>> {

}

class CBaseBase<T3> {
    constructor(x: Parameter<T3>) { }
}

class Parameter<T4> {
    method(t: T4) { }
}

class Wrapper<T5> {
    property: T5;
}
@RyanCavanaugh
Copy link
Member

Re [Breaking Change] -- when did this last work? It's an error in 0.9, 1.0, 1.1, and 1.3.

@JsonFreeman
Copy link
Contributor Author

@DanielRosenwasser, I do not understand your example. How could those constructor calls work, if the constructor takes a Parameter? C<number> is not a Parameter because it is missing method.

@RyanCavanaugh, I did not realize that. There was a user on 1.0, and they claimed to hit it on upgrade to 1.4 directly from 1.0.

@DanielRosenwasser
Copy link
Member

Ah, disregard my comment.

@RyanCavanaugh RyanCavanaugh removed the Breaking Change Would introduce errors in existing code label Jan 21, 2015
@RyanCavanaugh
Copy link
Member

Might be a more specific repro required to not error in 1.0. Removing tag for now.

@mhegazy mhegazy modified the milestones: TypeScript 1.5, TypeScript 1.6 Feb 5, 2015
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Apr 20, 2015
@mhegazy mhegazy modified the milestones: TypeScript 1.6, TypeScript 1.5.2 May 7, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 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

Successfully merging a pull request may close this issue.

5 participants