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

@swc/core removes the abstract declaration of the class, but the abstract declaration of the field is still there #9370

Closed
Yekongs opened this issue Aug 2, 2024 · 1 comment · Fixed by #9372
Assignees
Labels
Milestone

Comments

@Yekongs
Copy link

Yekongs commented Aug 2, 2024

Describe the bug

When disableBuiltinTransformsForInternalTesting is on,@swc/core processes an abstract class, it removes the abstract declaration of the class, but the abstract of the field remains, resulting in a syntax error

Input code

export default abstract class Predictor {
  abstract _type: string;
}

Config

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": true
    },
    "experimental": {
      "disableBuiltinTransformsForInternalTesting": true
    }
  },
}

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.7.4&code=H4sIAAAAAAAAA0utKMgvKlFISU1LLM0pUUhMKi4pSkwuUUjOSSwuVggoSk3JTC7JL1Ko5lJASMaXVBakWikAeZl56dZctVwAIiWcUEYAAAA%3D&config=H4sIAAAAAAAAA1WMQQqDQAxF955iyNoTdOmi0L0XSDUtKWMckgiKeHdTS4vd5b9H3lqlBC%2Fr4JLWOGMUVCP97SC2iOMcBHwpZJ1ycai%2F1u2tXCc6yPYRQHMh5YHiNZ9jPRveMzUTZ2dpFcUeow52HfUmTiqYW7JQz79qdZS3Hb53%2FwKvAAAA

SWC Info output

No response

Expected behavior

The abstract of the class should not be removed, otherwise it will cause syntax errors

Actual behavior

The abstract of the class was removed, and a syntax error occurred.

Version

1.7.4

Additional context

I added disableBuiltinTransformsForInternalTesting because I want my custom swc-loader to keep the source code as similar as possible after processing tsx/jsx, for example, tags are not converted to function form. The purpose is not to affect other people's swc-loader or plugins

Tasks

No tasks being tracked yet.
@Yekongs Yekongs added the C-bug label Aug 2, 2024
@magic-akari magic-akari self-assigned this Aug 3, 2024
@kdy1 kdy1 added this to the Planned milestone Aug 4, 2024
@kdy1 kdy1 closed this as completed in #9372 Aug 4, 2024
@kdy1 kdy1 closed this as completed in c2e3021 Aug 4, 2024
@kdy1 kdy1 modified the milestones: Planned, 1.7.6 Aug 4, 2024
@swc-bot
Copy link
Collaborator

swc-bot commented Sep 3, 2024

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Sep 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

4 participants