Skip to content

Decorator parsing after field with ASI'd arrow function fails #45157

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

Closed
weswigham opened this issue Jul 22, 2021 · 1 comment · Fixed by #45165
Closed

Decorator parsing after field with ASI'd arrow function fails #45157

weswigham opened this issue Jul 22, 2021 · 1 comment · Fixed by #45165
Labels
Bug A bug in TypeScript Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros Recent Regression This is a new regression just found in the last major/minor version of TypeScript.

Comments

@weswigham
Copy link
Member

Our RWC is showing some breaking changes that look like a bug in decorator parsing.

⏯ Playground Link

// @strict: true
// @experimentalDecorators: true
// @filename: index.ts
declare var someDecorator: any;
export default class Whatever {
    private _someField = () => {
        return 0;
    }
    @someDecorator
    getThing() {
        return 0;
    }
}

Workbench Repro

We used to parse this fine, but our RWC repo recently picked up that we started throwing a Decorators must precede the name and all keywords of property declarations. on the decorator, which is incorrect. The issue does not occur when the arrow function on the prior line is terminated with a semicolon.

@weswigham weswigham added Bug A bug in TypeScript Recent Regression This is a new regression just found in the last major/minor version of TypeScript. labels Jul 22, 2021
@typescript-bot typescript-bot added the Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros label Jul 22, 2021
@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 23, 2021

👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of the repro in this issue running against the nightly TypeScript.


Issue body code block by @weswigham

❌ Failed: -

  • Decorators must precede the name and all keywords of property declarations.

Historical Information

Issue body code block by @weswigham

Version Reproduction Outputs
Nightly

❌ Failed: -

  • Decorators must precede the name and all keywords of property declarations.

3.9.2, 4.0.2, 4.1.2, 4.2.2, 4.3.2

👍 Compiled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros Recent Regression This is a new regression just found in the last major/minor version of TypeScript.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants