microsoft / microsoft/TypeScript

Adjust relative imports in TypeScript when using copy-paste

Open
#59,841 4 comments 0 reactions 1 assignee View on GitHub

@navya9singh is already working on this.

Since Sep 4, 2024.

Experience Enhancement Suggestion
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

When copying an import from a file, it would be nice if pasting it in another file would adjust the path

Copying the import from src/folder1/a.ts:

//@filename: src/folder1/a.ts
import { x } from './b';

It would be very useful if pasting it in src/folder2/a.ts would generate (note how the import path was correctly adjusted):

//@filename: src/folder2/a.ts
import { x } from '../folder1/b';

This will be very useful once we switch to relative imports starting from tomorrow.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.