Skip to content

[Bug]: Stage 3 decorators behavior differences from TypeScript #16117

Description

@evanw

💻

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

See this repo: https://github.com/evanw/decorator-tests

Configuration file name

No response

Configuration

No response

Current and expected behavior

I'm working on adding stage 3 decorators to esbuild. My first step was to write a lot of tests and run them through the Babel and TypeScript implementations. I'm sending you this issue because I figured you might be interested to learn about the behavior differences that I found. This is not a problem for me as I don't use Babel myself, so feel free to close this issue after reading it if you'd like. Here are the unexpected behaviors I found with Babel's implementation (see the repo for details):

Caveat: I'm just learning about this feature now, and I'm also not sure how up-to-date the specification is, so it could be that Babel's behavior for some of these is intentional. But if so, that behavior at least differs from TypeScript's implementation, which seems undesirable. FWIW I'm currently mostly planning to align esbuild's behavior to TypeScript since it seems like it matches the specification more closely, so it'd be good to know if Babel's behavior here is actually more correct (e.g. regarding access).

Environment

I can reproduce this by running Babel using https://babel.dev/repl.

Possible solution

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Spec: Decoratorsi: discussionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions