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

VSCode - generate accessors fixup on readonly field removes modifier #33836

Closed
slaneyrw opened this issue Oct 7, 2019 · 0 comments · Fixed by #36543
Closed

VSCode - generate accessors fixup on readonly field removes modifier #33836

slaneyrw opened this issue Oct 7, 2019 · 0 comments · Fixed by #36543
Assignees
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol
Milestone

Comments

@slaneyrw
Copy link

slaneyrw commented Oct 7, 2019

TypeScript Version: 3.6.2

Search Terms: VSCode generate accessors

Logged issue with VSCode repo, but they asked my to create an issue "upstream"
microsoft/vscode#81135

Steps to Reproduce:

  1. Create private field with readonly modifier
  2. Highlight line and generate accessors
  3. get property created without set property ( correct ), but readonly modifier removed from field

Code

// before
class MyClass {

    private readonly _myField: number;

}


// after
class MyClass {

    private _myField: number;

    public get myField() {
        return this._myField;
    }
}

Expected behavior:

readonly modifier should remain on private field.
GET accessor created
SET accessor NOT created

Actual behavior:

readonly modifier is removed.
GET accessor created
SET accessor NOT created

Playground Link:

Related Issues:

@slaneyrw slaneyrw changed the title VSCode - -generate accessors fixup on readonly field removes modifier VSCode - generate accessors fixup on readonly field removes modifier Oct 7, 2019
@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol labels Oct 30, 2019
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol
Projects
None yet
3 participants