mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 13:48:46 -05:00
Fix rename for type symbols imported as a different name (#37745)
* Add failing test * Fix getMeaningFromLocation for imports * Only the name of an ImportEqualsDeclaration counts * Commit baseline
This commit is contained in:
@@ -92,7 +92,11 @@ namespace ts {
|
||||
if (node.kind === SyntaxKind.SourceFile) {
|
||||
return SemanticMeaning.Value;
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.ExportAssignment || node.parent.kind === SyntaxKind.ExternalModuleReference) {
|
||||
else if (node.parent.kind === SyntaxKind.ExportAssignment
|
||||
|| node.parent.kind === SyntaxKind.ExternalModuleReference
|
||||
|| node.parent.kind === SyntaxKind.ImportSpecifier
|
||||
|| node.parent.kind === SyntaxKind.ImportClause
|
||||
|| isImportEqualsDeclaration(node.parent) && node === node.parent.name) {
|
||||
return SemanticMeaning.All;
|
||||
}
|
||||
else if (isInRightSideOfInternalImportEqualsDeclaration(node)) {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/*====== /tests/cases/fourslash/canada.ts ======*/
|
||||
|
||||
export interface [|RENAME|] {}
|
||||
|
||||
/*====== /tests/cases/fourslash/dry.ts ======*/
|
||||
|
||||
import { RENAME as Ale } from './canada';
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: canada.ts
|
||||
////export interface /**/Ginger {}
|
||||
|
||||
// @Filename: dry.ts
|
||||
////import { Ginger as Ale } from './canada';
|
||||
|
||||
verify.baselineRename("", {});
|
||||
Reference in New Issue
Block a user