-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
support decorators altering return type of method #7349
Labels
Duplicate
An existing issue was already created
Comments
Another illustration of this limitation...
Note that the compiler insists that the type of |
This one is probably more difficult to add, and I know mixins are already on the TS roadmap, but if the type information of a class could be altered by decorators, that would be quite nice:
|
looks like a duplicate of #4881 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
TypeScript Version:
nightly (1.9.0-dev.20160217)
Code
Expected behavior:
I expect this to compile, and modify the return type of
MyClass#myMethod
.Actual behavior:
I'm trying to create a decorator that wraps methods, potentially altering the wrapped method's return type, making function composition possible through decoration. I initially thought this was a bug, but upon inspecting
MethodDecorator
's type signature, this is probably intentional:Can we add something like the following?
The text was updated successfully, but these errors were encountered: