Declare property quick fix should add private properties (or be configurable) #36249
Closed
Description
opened on Jan 17, 2020
TypeScript Version: 3.8.0-beta
Search Terms:
- quick fix
- declare property
Code
For the code:
class Foo {
constructor() {
this._bar = 1;
}
}
new Foo().other = 'a';
Trigger the quick fix to declare a missing property on _bar
.
Expected behavior:
The quick fix adds a private property _bar
:
class Foo {
private _bar: number;
constructor() {
this._bar = 1;
}
}
Actual behavior:
The quick fix adds a standard public property:
class Foo {
_bar: number;
constructor() {
this._bar = 1;
}
}
Playground Link:
Related Issues:
/cc @JacksonKearl
Activity