-
Notifications
You must be signed in to change notification settings - Fork 12
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
Result and undefined #69
Comments
You should already be able to set it to |
|
The typing should be updated to allow |
But hooks are not only about services, aren't they? Well if the official position is that |
That's fair. One option would be to add an |
Yeah, thought about it (symbol). But it creates problems when you work with arbitrary functions and set their result to |
It creates problems when In feathers ecosystem you control rules and you can ban undefined as a return value of services, solving the ambiguity. But when it is about random functions (many of which will be void, so should return only undefined) - i don't think you can make it work without opening door for bugs... I assume that you don't like the idea because of breaking nature, right? Or is there anything else against it? |
You're right, this is a good suggestion and I don't think it would be a breaking change. I just created a pull request in #70 that should allow to do what you are suggesting by checking if there is a property descriptor for |
To check if
result
is set and if a function should be skipped an equality to undefined is used. But what if one wants to setresult
to undefined as a real return value?Maybe
"result" in ctx
check should be used instead as a more strict rule? (And if you need to remove already set result from previous hooks, you'll dodelete ctx.result
.)(Just a thought, nothing more.)
The text was updated successfully, but these errors were encountered: