-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 3.9.0-dev.20200423
Search Terms:
- refactor / refactoring
- extract to function / method
Code
For the TypeScript code:
foo.ts
export class Foo { }
export const foo = new Foo();index.ts
import { foo } from './foo';
{
const x = foo;
console.log(x);
}- Select
console.log(x);and run the extract to function refactoring
Bug:
This adds an inline import type for Foo:
import { foo } from './foo';
{
const x = foo;
newFunction(x);
}
function newFunction(x: import("/Users/matb/projects/san/foo").Foo) {
console.log(x);
}Instead, it should add the import of Foo to the existing import at the top of the file
Related Issues:
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolFixedA PR has been merged for this issueA PR has been merged for this issue