Skip to content

[Bug]: Decorator metadata is not implemented #15889

@justinfagnani

Description

@justinfagnani

💻

  • Would you like to work on a fix?

How are you using Babel?

@babel/cli

Input code

function test(target, context) {
  console.log(context.metadata); // undefined
}

class A {
  @test foo;
}

I am not able to make a reproduction with the REPL due to: babel/website#1292 since the decorator plugin has a required option that can't be set.

Configuration file name

.babelrc

Configuration

{
  "plugins":[
    "@babel/plugin-transform-class-static-block",
    ["@babel/plugin-proposal-decorators", {"version": "2023-05", "decoratorsBeforeExport": true}],
    ["@babel/plugin-proposal-class-properties"]
  ]
}

Current and expected behavior

context.metadata should be an object per https://github.com/tc39/proposal-decorator-metadata

Environment

"@babel/cli": "^7.22.10",
"@babel/core": "^7.22.11",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.22.10",
"@babel/plugin-transform-class-static-block": "^7.22.11",

Possible solution

No response

Additional context

TypeScript 5.2 (due to be released the week of 8/22) implements decorator metadata.

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: needs triageoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions