-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Polymorphic "this" isn't polymorphic in some cases #5493
Comments
So this use case is not supported? Based on my example is there any other way to accomplish what I'm attempting? This isn't an unusual pattern for Resource/Model implementation. |
that is correct. constructors are really part of the static side of classes, and for these
As mentioned earlier, this was not part of the original implementation. we should reconsider thought. |
That was a lie. It seems confused at best :( |
Sorry for the crap title, I'm not entirely sure what is going on but I think it's a bug. I also think this is somewhat related to #5449 but am unsure.
Library Example:
User Code Example:
The issue that the compiler complains about is as follows:
If I change the extended model to be specific it errors in different way, but same theme.
I think the reason is because
this
isn't being polymorphic in either the template or the constructor. Whenthis
is analyzed in the constructor ofBaseModel
it seems to stick with that context.I initially posted about the use of polymorphic
this
which was answered by @RyanCavanaugh http://stackoverflow.com/questions/33443793/create-a-generic-factory-in-typescriptThe text was updated successfully, but these errors were encountered: