Closed
Description
TypeScript Version: 3.9.0-dev.20200420
Search Terms:
- extract to function
- refactor / refactoring
Repro
class Foo {
x = 1
bar() {
console.log(() => { this.x; });
}
}
- Select
console.log(() => { this.x; });
and runextract to function
Bug:
The generate code uses this
inside the extracted function:
class Foo {
x = 1
bar() {
newFunction();
}
}
function newFunction() {
console.log(() => { this.x; });
}
The extract to function
refactoring probably should not be offered in this case.