Closed
@mjbvz

Description

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