microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.22k stars 12.52k forks source link

Rename file by renaming on an aliased path #27959

Open mjbvz opened 6 years ago

mjbvz commented 6 years ago

From https://github.com/Microsoft/vscode/issues/60918

TypeScript Version: 3.2.0-dev.20181019

Search Terms:

Code For a simple js project

jsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es2016",
        "jsx": "preserve",
        "checkJs": true,
        "baseUrl": ".",
        "paths": {
            "~/*": [
                "*"
            ]
        }
    },
    "exclude": [
        "node_modules",
        "**/node_modules/*"
    ]
}

main.ts

import * as foo from '~/src/foo';

console.log(foo);

src/foo.js

export class Foo { }
  1. In main.js, f2 rename on foo in the path

Expected behavior: This should allow renaming foo.js

Actual behavior: See error: you cannot rename a module via a global import

heavenkiller2018 commented 4 years ago

is there any plan to fix it?

varthc commented 1 year ago

Any update? Thanks!

timoisalive commented 1 year ago

Yep, hoping to see a fix to this as well, now that also Expo projects support path aliases (https://docs.expo.dev/guides/typescript/#path-aliases).

simplenotezy commented 4 months ago

This have been mentioned many times across different issues, but I don't see any solution. Is there one, or are we just currently doomed if we use aliased imports?

https://github.com/microsoft/vscode/issues/97135