-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Static method inheritance #3334
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
Comments
Yep, I understand why it exists but it would be really disappointing if there is no way to make a .d.ts that properly describes the behavior of TweenMax. I'm not suggesting a change to how Typescript handles inheriting static methods (at least I don't think I am) but it would be nice if there was a way to indicate that that's how the types work in existing Javascript code. I'm just interested in finishing the TweenMax.d.ts file so that I can start using it in my project. |
It's always possible to rewrite the classes in terms of their static and instance sides. See "Class Decomposition" in the TypeScript Handbook http://www.typescriptlang.org/Handbook#writing-dts-files |
Ah, that's a very interesting pattern that I wasn't aware of. I decomposed the class and now things are working, only thing is the autocomplete for Thanks for the guidance, I'll definitely keep that in mind :) |
I don't see any error on this in either 1.4 or 1.5. I think the only way you could get an error on this |
Hmm... I just tried it again and it seems to be working correctly (though it's yelling that the static side doesn't extend properly, I suspect that's from other problems at this point since a simple example like yours appears to work). That's strange because when I first opened this issue it was definitely insisting that TweenMax.to returned a TweenLite, contrary to the signature. I had multiple people look at it, so I think not crazy and I'm not sure why it's working now. Perhaps it was a project configuration issue on my end... |
Looks like the issue has been handled. please reopen if there is any other issues. |
There's been some previous discussion about this https://typescript.codeplex.com/workitem/2047 but nothing seems to have come of it. I've got a real scenario where this is getting in the way.
I'm trying to make a .d.ts file for greensock's gsap TweenMax but I have an issue where TweenMax extends TweenLite, which has a
static to(target:Object, duration:number, vars:Object):TweenLite
, and TweenMax has astatic to(target:Object, duration:number, vars:Object):TweenMax
.I can't use the TweenMax.to method because it's being hidden by the TweenLite.to, which makes most of the module useless.
If there's a way to make the definition work as intended I'd love to hear it, otherwise it would be nice to see this fixed.
The text was updated successfully, but these errors were encountered: