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

Supporting type self or something that can represents the current instance. #2179

Closed
vilicvane opened this issue Mar 2, 2015 · 2 comments
Closed
Labels
Duplicate An existing issue was already created

Comments

@vilicvane
Copy link
Contributor

When I am writing a declaration file, I found it really frustrating repeating the inherited method that returns the instance itself for a correct return type.

E.g. for animation library GSAP, many classes are inherited from class Animation, I have to repeat almost every method to update return type Animation to the current class.

class Animation {
    chain(): Animation;
}

class TweenLite extends Animation {
    ownProperty: any;
    chain(): TweenLite;
}

It would be great if we may use some type like self to make this easier, like this:

class Animation {
    chain(): self;
}

class TweenLite extends Animation {
    ownProperty: any;
}
@DanielRosenwasser
Copy link
Member

Seems like a duplicate of #285.

@DanielRosenwasser DanielRosenwasser added the Duplicate An existing issue was already created label Mar 2, 2015
@danquirk
Copy link
Member

danquirk commented Mar 2, 2015

Also see #513

@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
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants