-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Symbol.metadata is undefined #22111
Comments
What are you expecting this would do? No browser, nor node, implement a |
Consider this example: function bind(_: unknown, ctx: ClassMethodDecoratorContext<any>) {
ctx.addInitializer(function () {
this[ctx.name] = this[ctx.name].bind(this);
});
}
class Person {
constructor(private firstName: string, private lastName: string) {}
@bind
greet() {
console.log(`Hellou ${this.firstName} ${this.lastName}`);
}
@bind
static start() {
console.log("Hello World!", this);
}
}
Person.start(); It prints: Perhaps it should print the empty object shown in the console meanwhile? |
I also don't understand what's the problem here. Where is the |
It comes directly from the runtime, so the metadata exists but is not exposed? I got curious about that data in the console. |
Given Deno supports decorators in TypeScript it should expose the symbol, Deno already supports |
Yeah, I checked and SWC does transpile decorator metadata. We should polyfill |
This commit adds support for "Symbol.metadata" which was omitted when adding support for the Decorators Proposal. Closes #22111
This commit adds support for "Symbol.metadata" which was omitted when adding support for the Decorators Proposal. Closes #22111
Version: Deno 1.40.1
Thanks.
The text was updated successfully, but these errors were encountered: