-
Notifications
You must be signed in to change notification settings - Fork 549
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
Implicit return initial values #69
Implicit return initial values #69
Conversation
This would require a compilation step. Omitting the In addition, I do not believe a compiler step enabling such a step would provide any meaningful benefit to one's workflow but it could hinder readability and understanding because javascript in general does not work this way. |
This could be possible by making the functions (
This could be added to vue-loader but then the JS from the Finally, having the explicit return, also allows for switching different solutions easily while developing, by commenting out lines: setup () {
const { mouseX, mouseY } = useMouse()
const { eyeX, eyeY } = useEyeTracking()
// we can swap comments to switch what values are used
return {
x: mouseX,
y: mouseY,
// x: eyeX,
// y: eyeY,
}
} |
Thanks for your reply
Effectively, add a compilation step would be a problem and wouldn't respect the initial idea.
Have a nice day Eduardo.
|
Wouldn't it possibly hurt type inference in TypeScript in the future? |
Yes, an implicit return will break type inference as well |
I don't think that's a good idea, because you could have reactive value that you don't want to expose to the template when using in a component. |
Since this goes against one of the main aspect of the API: typing, let's drop it |
Rendered