Skip to content

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

Closed
@weswigham

Description

@weswigham

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHas ReproThis issue has compiler-backed repros: https://aka.ms/ts-reprosRecent RegressionThis is a new regression just found in the last major/minor version of TypeScript.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions