Skip to content

TypeScript: After moving file into new destination its extensions declare module '../types' { are not changing path of module being extending #61639

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

Closed
psnet opened this issue Apr 4, 2025 · 3 comments
Labels
Not a Defect This behavior is one of several equally-correct options

Comments

@psnet
Copy link

psnet commented Apr 4, 2025

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

Version: 1.99.0 (user setup)
Commit: 4437686ffebaf200fa4a6e6e67f735f3edf24ada

Steps to Reproduce:

  1. Lets have file types.ts
interface CoolInterface {
    something: boolean;
}
  1. Lets have file thisFileWillBeMoved.ts
declare module './types' {
    interface CoolInterface {
        newProp?: boolean;
    }
}
  1. Lets move file thisFileWillBeMoved.ts into newly created folder test
  2. After moving file into new destination its extensions declare module './types' { are not changing path of module being extending. Must be:
declare module '../types' {  // path must be changed
@mjbvz mjbvz transferred this issue from microsoft/vscode May 1, 2025
@mjbvz mjbvz removed their assignment May 1, 2025
@RyanCavanaugh RyanCavanaugh added the Not a Defect This behavior is one of several equally-correct options label May 2, 2025
@RyanCavanaugh
Copy link
Member

I think this would be more confusing than helpful on average. If you move the files one at a time we won't have any way to realize that the relative path should un-changed once the second file moves over. Modifying these kind of paths is pretty fraught. Absent other feedback on this (haven't seen any), the status quo seems better than trying to make this code more complex than it already is.

@psnet
Copy link
Author

psnet commented May 2, 2025

Yes, your comment makes sense, but while we change imports path seems like at least to look at this case too. Yes, it more rare condition but still is path that is broken after moving files.

@typescript-bot
Copy link
Collaborator

This issue has been marked as "Not a Defect" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Not a Defect This behavior is one of several equally-correct options
Projects
None yet
Development

No branches or pull requests

4 participants