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

Typescript refactoring ignores contextual this in objects nested in classes #41343

Open
pushkine opened this issue Oct 30, 2020 · 0 comments
Open
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol
Milestone

Comments

@pushkine
Copy link
Contributor

vscode 1.50.1
ts4.0.3 & ts4.1.0-dev.20201029

class Foo {
	o: object;
	constructor() {
		this.o = {
			bar() {
				return 1 + 1;
			},
		};
	}
}

Refactoring options in o.bar include extraction into a method in Foo, which is not accessible through the contextual this
Expected refactoring options to not include solutions that break code

Code_2020-10-30_17-45-02

Code_2020-10-30_17-45-13

@mjbvz mjbvz transferred this issue from microsoft/vscode Oct 30, 2020
@mjbvz mjbvz removed their assignment Oct 30, 2020
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Nov 10, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Nov 10, 2020
@RyanCavanaugh RyanCavanaugh added the Domain: Refactorings e.g. extract to constant or function, rename symbol label Nov 10, 2020
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
Development

No branches or pull requests

3 participants