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;
}
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 typeAnimation
to the current class.It would be great if we may use some type like
self
to make this easier, like this: