known
known copied to clipboard
Known as a class decorator
Can you elaborate?
The ability to use this as a class decorator:
@known
class Foobar {
baz = 1;
someMethod() {}
}
Foobar.crap
> [TypeError] Unknown property: crap
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.
A decorator is just a function with a pre-defined set of arguments. So it should be perfectly possible.
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