-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Do not rename imports from ambient modules #8227
Comments
@mhegazy Option 2 or 3 is fine for me because they are local renaming, and i don't rename at the site of import very often. But if i would use that renaming feature from the site of import i think option 3 is more useful in practice. |
Approved. The fix here is just to block rename invocations in certain syntactic locations (we can start with this particular one and add more as we find them). |
This also should cover all symbols declared in .d.ts files, as long as the operation is not initiated from this .d.ts file. |
I believe the behavior I'm encountering is relevant to this bug. In a freshly initialized project, renaming things like
The file I'm attempting the rename in:
The request for the rename of
And the response:
This is expected. However, as soon as you add a
Using the same file as before, here is the request for the rename:
And the response:
This also occurs in things included via TypeScript's |
related #11863 |
Perhaps this could be expanded to not rename things from node_modules (or at least give a warning) folder? |
Issue explained by @bbgone in #8118 (comment)
Renaming an import alias for a module coming from a .d.ts file, renames all instances. this is obviously wrong.
Options, 1. error (obviously not helpful), 2. only rename local symbol (better, but leaves the code in an invalid state), 3. rename local import and add
as oldname
clause to the import declaration as needed (looks like the best solution).This is similar to the issue related to #7458, except that this issue adds renaming the import alias.
The text was updated successfully, but these errors were encountered: