Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility of using a getter with a parameter? #40

Closed
sneko opened this issue Oct 23, 2018 · 2 comments
Closed

Possibility of using a getter with a parameter? #40

sneko opened this issue Oct 23, 2018 · 2 comments

Comments

@sneko
Copy link

sneko commented Oct 23, 2018

Hi @championswimmer 馃槂

I was wondering if there is a way with your plugin to define a method with parameters as a getter?

get getUser() { ... } works
get getUser(id: string) { ... } does not work since the ES6 syntax does not allow get methods to have parameters

I didn't find anything about that in your code but I was thinking about something like:

@Getter
getUser(id: string) { ... }

Or maybe I missed something?

Thank you,

@championswimmer
Copy link
Owner

championswimmer commented Oct 24, 2018

you return a function from getter

get getUser() { return function (id: string) { /* ... */ } }

@mechanicalgux
Copy link

This should be in the documentation :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants