useAliasesForRenames
does not prevent rename in the original file in another project
#45734
Labels
Bug
A bug in TypeScript
Domain: Refactorings
e.g. extract to constant or function, rename symbol
Effort: Casual
Good issue if you're already used to contributing to the codebase. Harder than "good first issue".
Help Wanted
You can do this
Rescheduled
This issue was previously scheduled to an earlier milestone
Milestone
Bug Report
🔎 Search Terms
Rename refactor, Named import, Alias for renames, project, tsconfig, folders, directories
🕗 Version & Regression Information
This was not fixed in the most recent nightly version 4.5.0-dev.20210905.
⏯ Playground Link
Typescript workbench apparently does not support JSON files, therefore it can not create multiple projects required to reproduce this bug.
Here is the link to GitHub MWE Repo.
💻 Code
Make sure that
typescript.preferences.useAliasesForRenames
is enabled (default).lib
, and the other atsrc
.tsconfig.json
with any content. An empty object will do.lib/lib.ts
create a file with the following content:src/main.ts
create a file with the following content:lib/lib.ts
and then opensrc/main.ts
.variable
insrc/main.ts
.🙁 Actual behavior
In addition to creating an alias in
src/main.ts
like the followingvariable as newName
, the original filelib/lib.ts
also has its exported variablevariable
renamed tonewName
. This causes Typescript to err thatlib/lib.js has no exported member named variable
.🙂 Expected behavior
If
typescript.preferences.useAliasesForRenames
is enabled, then only create the alias. Do not rename the exported variable as well. This behaviour is currently done when the two files are in the same project.The text was updated successfully, but these errors were encountered: