dsherret / dsherret/ts-morph

Renaming exported interface leads to invalid name of import type in same file

Open
#1,237 1 comment 0 reactions 0 assignees View on GitHub
needs more info
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

Renaming an exported interface leads to a invalid import type reference when the import type is in the same file as the interface

Version: 13.0.2

**To Reproduce**

```
project.createSourceFile('.', 'export interface Tom {}\n' +
'const a: import(\'C:/Users/liamh/PrivateProgramming/ts-morph-testing/morph/morph\').Tom = {};')
sourceFile.getDescendantsOfKind(SyntaxKind.InterfaceDeclaration).forEach(i => i.rename('Mike'));
````

Expected Result:

```
export interface Mike {}
const a: import('C:/Users/liamh/PrivateProgramming/ts-morph-testing/morph/morph').Mike= {};
```

Received Result:

```
export interface Mike {}
const a: import('C:/Users/liamh/PrivateProgramming/ts-morph-testing/morph/morph').MikeTomMike = {};
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.