Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@slaneyrw

Description

@slaneyrw
Issue body actions

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:

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbol

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.