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

Support auto-accessors #6477

Closed
dsherret opened this issue Nov 18, 2022 · 5 comments
Closed

Support auto-accessors #6477

dsherret opened this issue Nov 18, 2022 · 5 comments
Assignees
Milestone

Comments

@dsherret
Copy link
Contributor

dsherret commented Nov 18, 2022

Describe the feature

TypeScript 4.9 (released on Tuesday) supports auto-accessors:

class Person {
    accessor name: string;

    constructor(name: string) {
        this.name = name;
    }
}

It would be nice if swc supported this keyword.

Babel plugin or link to the feature description

https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#auto-accessors-in-classes

microsoft/TypeScript#49705

Additional context

No response

@dsherret dsherret changed the title Support auto-accessors from TS 4.9 Support auto-accessors Nov 18, 2022
@kdy1 kdy1 added this to the Planned milestone Nov 18, 2022
@dsherret
Copy link
Contributor Author

dsherret commented Dec 6, 2022

Babel is also missing this feature. They've started working on it here: babel/babel#15209

FWIW, TypeScript has just made the accessor keyword a modifier under a property declaration. Maybe a quick first pass might just be to add a boolean property for this to PropertyDeclaration https://ts-ast-viewer.com/#code/MYGwhgzhAEAKCmAnCB7AdtA3gKGn6Yww8UKi0aYAtvAFzQQAuiAlmgOYDc2u+w6TRAFdgjMgApKNeoLbsAlFl758jABYsIAOinxoAXgrV43FQF9sZoA

@kdy1 kdy1 assigned kdy1 and unassigned kdy1 Jan 17, 2023
@kdy1 kdy1 self-assigned this Mar 9, 2023
@dsherret
Copy link
Contributor Author

@kdy1 I think this one can be closed? I noticed this seems to be supported now (thanks!)

@kdy1
Copy link
Member

kdy1 commented Mar 16, 2023

The parser is implemented but I'm still working on transforms

@kdy1
Copy link
Member

kdy1 commented May 9, 2023

Closing in favor of #7193

@kdy1 kdy1 closed this as completed May 9, 2023
@kdy1 kdy1 modified the milestones: Planned, v1.3.58 May 15, 2023
@swc-bot
Copy link
Collaborator

swc-bot commented Jun 14, 2023

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 Jun 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants