Skip to content

Renaming alias in export specifier no longer works in 3.8 RC when name equals propertyName #36695

Description

TypeScript Version: 3.8.0-dev.20200208

Search Terms: rename export specifier alias

This actually works for me in VS code for some reason when using @next, but not when using the compiler api directly. Maybe my VS code setup is wrong though.

Why?

This bug will block me from doing a ts-morph release unless I come up with a new solution for renaming only the exported name. Previously it worked to change the export to export { name } to export { name as name} then use rename on the language service to go to export { name as newAlias }.

Code

// a.tsexportclassname{}// b.tsimport{name}from"./a";export{nameasname/* rename this identifier */};// c.tsimport{name}from"./b";

Expected behavior:

// a.tsexportclassname{}// b.tsimport{name}from"./a";export{nameasnewAlias};// c.tsimport{newAlias}from"./b";

Actual behavior:

// a.tsexportclassnewAlias{}// b.tsimport{newAlias}from"./a";export{newAliasasnewAlias};// c.tsimport{newAlias}from"./b";

Result of calling languageService.findRenameLocations("/b.ts", 45, false, false, false):

[ { textSpan: { start: 9, length: 4 },
fileName: '/b.ts',
contextSpan: { start: 0, length: 27 } },
{ textSpan: { start: 37, length: 4 },
fileName: '/b.ts',
contextSpan: { start: 28, length: 24 } },
{ textSpan: { start: 13, length: 4 },
fileName: '/a.ts',
contextSpan: { start: 0, length: 20 } },
{ textSpan: { start: 9, length: 4 },
fileName: '/c.ts',
contextSpan: { start: 0, length: 27 } },
{ textSpan: { start: 45, length: 4 },
fileName: '/b.ts',
contextSpan: { start: 28, length: 24 } } ]

Metadata

Metadata

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions