π Search Terms
shorthand property refactor
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about shorthand properties
β― Playground Link
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAZxtApnAZlCI4CIB0A9EqrgNwBQFhhcAbggMYQAmaAtAHxwBKK6AQ0bIocLnACyEOmmRwAdigDuGYABsUVGpOnB5AczgwAFsAQYArvOHAI8uEvVq4UFDAF6jxtKEiwKKAAefvDoVjZ2cAIAFACUcADeFHApcMzyCBAa+GoQ+tEJJK4AvrGUxVq0UnR6hiZmltYwtvaOas6uINKy3nC+0DABwQONEfYARnGJyanpmdm5+UUoZRQVQA
π» Code
import store from "./store";
// vscode -> Refactor -> Move to new file
// Moving this function will retain the import
export function a() {
console.log({store});
}
// Moving this function will remove the import
export function b() {
console.log(store);
}
π Actual behavior
Import statement is removed when function b is removed.
π Expected behavior
Import statement is retained when function b is removed because it's used by function a.
Additional information about the issue
Happens in vscode and when using LanguageService.getEditsForRefactor.
π Search Terms
shorthand property refactor
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAZxtApnAZlCI4CIB0A9EqrgNwBQFhhcAbggMYQAmaAtAHxwBKK6AQ0bIocLnACyEOmmRwAdigDuGYABsUVGpOnB5AczgwAFsAQYArvOHAI8uEvVq4UFDAF6jxtKEiwKKAAefvDoVjZ2cAIAFACUcADeFHApcMzyCBAa+GoQ+tEJJK4AvrGUxVq0UnR6hiZmltYwtvaOas6uINKy3nC+0DABwQONEfYARnGJyanpmdm5+UUoZRQVQA
π» Code
π Actual behavior
Import statement is removed when function
bis removed.π Expected behavior
Import statement is retained when function
bis removed because it's used by functiona.Additional information about the issue
Happens in vscode and when using
LanguageService.getEditsForRefactor.