Skip to content

"Move to new file" does not copy namespace imports #33156

Closed
@OliverJAsh

Description

@OliverJAsh

TypeScript Version: 3.5.2, 3.6.2

Search Terms:

Code

// ./src/foo.ts
export const whatever = 1;
// ./src/index.ts
import * as foo from './foo';

const bar = foo.whatever;

export default bar;

Expected behavior:
When copying the line const bar and actioning the "Move to new file" command, the new file contents should be:

import * as foo from './foo';
export const bar = foo.whatever;

Actual behavior:
The new file contents are:

export const bar = foo.whatever;

The foo namespace import is missing, which creates errors:

image

Playground Link:

Related Issues: #27937, which was apparently fixed but it seems to be happening again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbol

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions