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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation is misleading about the @map decorator #400

Open
boris-petrov opened this issue Feb 13, 2019 · 3 comments
Open

Documentation is misleading about the @map decorator #400

boris-petrov opened this issue Feb 13, 2019 · 3 comments

Comments

@boris-petrov
Copy link

boris-petrov commented Feb 13, 2019

I guess for many others too. It says that it is usable in both ways:

  @map('chores')
  loudChores(chore, index) {
    return chore.toUpperCase() + '!';
  } // ['CLEAN!', 'WRITE MORE UNIT TESTS!']

  // alternative syntax:

  @map('chores', function(chore, index) {
    return chore.toUpperCase() + '!';
  }) loudChores; // ['CLEAN!', 'WRITE MORE UNIT TESTS!']

But when I use the first one, I get a deprecation warning:

Ember Decorators currently supports using the map macro on a function directly, but this is not supported by Ember's official decorators. We'll be removing support in future versions. [deprecation id: macro-function-decoration]

The second one doesn't give it so I guess it is the right way to do it? If so, the "bad" example should be removed from the documentation. If not, what is the right way to use @map?

@buschtoens
Copy link
Collaborator

What version of ember-decorators are you using?

@boris-petrov
Copy link
Author

5.1.3.

@pzuraq
Copy link
Contributor

pzuraq commented Feb 13, 2019

We should remove the first example, unfortunately I don't think we'll be able to support the first version upstream without another RFC which is why we started adding the deprecation. FWIW, I think a third party decorator library with different goals will be able to bring back this style of decorator

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