Skip to content
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

Incorrectly allowing parameter decorators in JavaScript when decorators parser option is set to true #9661

Open
rwalle opened this issue Oct 19, 2024 · 0 comments
Labels

Comments

@rwalle
Copy link

rwalle commented Oct 19, 2024

Describe the bug

Parameter decorator is part of TypeScript experimental decorator implementation, and is not in the tc39 decorator proposal that is at stage 3. While they could potentially be added in the future, they should not be allowed along with other "planned" decorator feature like class/method/function decorators.

Input code

class ExampleClass {
  method(@deprecated x = 3) {}
}

Config

No response

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.7.36&code=H4sIAAAAAAAAA0vOSSwuVnCtSMwtyEl1BnOquRQUclNLMvJTNBxSUguKUpMTS1JTFCoUbBWMNRWqa7lqAQKoNJE1AAAA&config=H4sIAAAAAAAAA42VwY4aMQyG7%2FsUaM490F2pqvoAvfUZopA4Q2gmHsUOC1rx7vUEhtLFM%2BoFMf5ix3Z%2BJx8vm013INf92HzIX%2FkYbSEo92%2Bx0DmzPYmlAzdYciWO3H2Z6YEmFGwiuNs8OCyWsZAgLhUauFx5x7b0wC0evW5ft7dYXUIk%2BDdWN8Qcw%2FkxG4fDWIDowSZWCVkHyEyfc2ms4PucyYN9h5jA5hViLJmYGXooWmCHKdmRwBxtUaJMmdoSCbUtJlgZvBkLjirPPnLELHs%2BUw%2FWG4ceFBQLOI5H0NxkL3HLJOUp9TTsYVf7vingkzccbaqWlT3h1I5EslWi7jESm1Cz1sIrXOjBFd6a%2B9kzBlOAa8nPfgeMeeFMfgNIB5IlynYALW5bEURPS95h1TPmIJLls8JF31qVGXppqokxKJ2dOgOFo3aaBXx1MHXWaenc8EL7KHowEIJoRQlN75HdXtuUzyNgUICcrw2aqq7A3KdwgU8DsYJ%2FSpWsC%2By2YrC8X6Z0HnaYVjYYgPfoVxbIUTAu4yK3xGlc5jV7EGmAV5dUauD5EpABYDSp3ZdP2pDxkIimT7hTr4lRdN4O8e1mu9yv6MHmvl0CD5co45jgCGlJ2%2F8xN6tUEj5OUp%2FH%2FWmk4bumVCvTGL9uZzSX8jL%2FtqK6AX19KKgJ9frGfOv%2BLpqfk7lRXaRfs2N7qC5%2FACIzE1gSBwAA

SWC Info output

No response

Expected behavior

An error will be emitted.

Actual behavior

An AST is generated using TypeScript experimental decorator behavior

Version

1.7.36

Additional context

No response

@rwalle rwalle added the C-bug label Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants
@rwalle and others