-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Incorrect type for ClassDecorator
#29828
Comments
Would that still work with abstract classes? |
I'm afraid the issue is still there in tsc 3.4.5 . A few ideas when writing another for myself:
I am using this now (it assumes constructor and instances types are not changed): type ClassDecorator2 = <C extends new(...args: any[])=>{}>(target: C) => C | void; |
I just ran into this. Assuming (I think reasonably) that the builtin If this remains a low priority to get right, I recommend at least making the builtin type much more permissive for anyone else running into this, since decorators are far more flexible than |
Just ran into this again (will be every time when using class decorator). Here's the reproducible case The workaround from previous comment works as long as there's no static methods in the class being decorated. Curios to know how this can improved. |
Also note, that application of class decorators does not generate error, even that the intention is to decorate only subclasses of I believe |
The current (3.2.2) type for class decorator function seems to be incomplete:
It says that target should extend a Function, but it should be something like
NewableFunction
I guess, since its a class constructor and it can be passed tonew
.The text was updated successfully, but these errors were encountered: