Skip to content

fix(asi): avoid ASI hazard after erased annotations on fields - #76

Merged
acutmore merged 1 commit into
mainfrom
swc-12575-bug-1
Oct 20, 2026
Merged

acutmore merged 1 commit into
mainfrom
swc-12575-bug-1

Conversation

@acutmore

Copy link
Copy Markdown
Collaborator

As reported on swc-project/swc#12575 (bug 1)

A class field without an initializer can be named get, set or static. If that field has a ?, a ! or a type annotation, erasing it can turn the name into a modifier of the next member:

class C {
    get?: number
    foo() {}
}

Before this fix, the output made foo a getter, and the field get did not exist. The output now starts the erased span with ;, which matches tsc output.

…et, set or static

Signed-off-by: aclaymore <aclaymore@bloomberg.net>
@acutmore acutmore added the bug Something isn't working label Oct 20, 2026
@acutmore
acutmore merged commit ba04b4e into main Oct 20, 2026
4 checks passed
@acutmore
acutmore deleted the swc-12575-bug-1 branch October 20, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants