8000 Known as a class decorator · Issue #1 · sindresorhus/known · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Known as a class decorator #1

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

Open
eranimo opened this issue Jul 7, 2016 · 5 comments
Open

Known as a class decorator #1

eranimo opened this issue Jul 7, 2016 · 5 comments

Comments

@eranimo
Copy link
eranimo commented Jul 7, 2016

No description provided.

@sindresorhus
Copy link
Owner

Can you elaborate?

@eranimo
Copy link
Author
eranimo commented Jul 8, 2016

The ability to use this as a class decorator:

@known
class Foobar {
    baz = 1;
    someMethod() {}
}
Foobar.crap
> [TypeError] Unknown property: crap

@sindresorhus
Copy link
Owner

That would indeed be very nice, but decorators is just an ECMAScript stage 1 proposal at the moment.

https://github.com/wycats/javascript-decorators/blob/master/README.md

Would be happy to accept a pull request if it's possible to support it without transpiling this code though.

@SamVerschueren
Copy link

A decorator is just a function with a pre-defined set of arguments. So it should be perfectly possible.

@pedromrb
Copy link
pedromrb commented May 4, 2017

Hey guys, I'm trying to pick this up but i'm sure if i got the gist of it. Since transpiling is out of the question, wouldnt wrapping it in high order function result in the same invocation, like

known([random class here]).

Thank you

@satazor satazor mentioned this issue May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0