Skip to content

TypeScript: 3 connected together BUGS in Refactor: move to file #62022

Open
@psnet

Description

@psnet

Does this issue occur when all extensions are disabled?: Yes

Version: 1.97.2 (user setup)
Commit: e54c774e0add60467559eb0d1e229c6452cf8447

Steps to Reproduce:

  1. TS File with name original.ts:
/**
 * Description
 */
export const NAME1 = 3;
  1. Use Refactor: move to file for previously created new empty file test.ts
  2. Bug 1: in new test.ts we have one empty line between JSDoc and const NAME1:
/**
 * Description
 */
<--------------------------- BUG 1: WHY new empty LINE here?
export const NAME1 = 3;
  1. Lets back to original.ts and move another constant to test.ts from file we moved first constant (original.ts), after same use case in test.ts file where we moved 2 constants formatting will be weird:
/**
 * Description
 */
<--------------------------- BUG 1: WHY new empty LINE here?
export const NAME1 = 3;/**<--------------------------- BUG 2: WHY JSDoc is at end of const declaration?
 * Description of second constant
 */

export const NAME2 = 2;

BUG 2: JSDoc of second constant jumps at end of first constant.
5. BUG 3: Lets look at other file that had imports for these constants, now they have TWO imports from file test.ts where we moved 2 constants (must be 1 import).

import { NAME1 } from '../../test';
import { NAME2 } from '../../test';  <--------------------------- BUG 3: WHY TWO imports from same file?

Other files are corrupted too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions