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

Move to File does not generate imports in the same way that autoimports does #59961

Open
iisaduan opened this issue Sep 13, 2024 · 0 comments
Open
Assignees
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol

Comments

@iisaduan
Copy link
Member

iisaduan commented Sep 13, 2024

In

} from "./_namespaces/ts.js";
under } from "./_namespaces/ts.js"; (the last import), add

export interface Foo {
    foo: number;
}

export function f(): Foo {
    return { foo: 1 };
}

select export interface Foo { ... } and using moveToFile, move it to compiler/types.ts

Actual behavior:
// @Filename compiler/expressionToTypeNode.ts

} from "./_namespaces/ts.js";
import { Foo } from "./types.js";

export function f(): Foo {
    return { foo: 1 };
}

Expected behavior:
Foo is imported from the namespace. Note this correct behavior is the current behavior that happens through calling autoimports directly. If I delete the wrong import above and then auto-import on Foo, we get the following as well.

...
Foo,
...
 } from "./_namespaces/ts.js";

export function f(): Foo {
    return { foo: 1 };
}

tags: moveToFile, moveToNewFile, move to new file, auto imports

@iisaduan iisaduan added Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol labels Sep 13, 2024
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

2 participants