Skip to content

Commit 82691b0

Browse files
committed
support var symbol renaming
1 parent bbaa062 commit 82691b0

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

src/collisions-resolver.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { verboseLog } from './logger';
1111

1212
const renamingSupportedSymbols: readonly ts.SymbolFlags[] = [
1313
ts.SymbolFlags.Alias,
14+
ts.SymbolFlags.FunctionScopedVariable,
1415
ts.SymbolFlags.BlockScopedVariable,
1516
ts.SymbolFlags.Class,
1617
ts.SymbolFlags.Enum,

tests/e2e/test-cases/names-collision-across-files/file1.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ const TEMPLATE = 'template1';
22
export default TEMPLATE;
33

44
export const MergedSymbol = '';
5+
6+
export var Variable = 1;
7+
58
export interface MergedSymbol {
69
test(): void
710
};

tests/e2e/test-cases/names-collision-across-files/file2.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ const TEMPLATE = 'template2';
22
export default TEMPLATE;
33

44
export const MergedSymbol = '';
5+
6+
export var Variable = '';
7+
58
export interface MergedSymbol {
69
test(): void
710
};

tests/e2e/test-cases/names-collision-across-files/input.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export {
1010
TypeName as T1,
1111
func as f1,
1212
NamespaceName as NS1,
13+
Variable as V1,
1314

1415
// rename these to include them into import
1516
AnotherInterface as AI1,
@@ -24,6 +25,7 @@ export {
2425
TypeName as T2,
2526
func as f2,
2627
NamespaceName as NS2,
28+
Variable as V2,
2729

2830
// yes, keep these without renaming so we can check that these aren't exported with wrong names
2931
AnotherInterface,

tests/e2e/test-cases/names-collision-across-files/output.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ declare namespace ExportEqNs$1 {
2525
}
2626
declare const TEMPLATE = "template1";
2727
declare const MergedSymbol = "";
28+
declare var Variable: number;
2829
interface MergedSymbol {
2930
test(): void;
3031
}
@@ -43,6 +44,7 @@ declare namespace NamespaceName {
4344
}
4445
declare const TEMPLATE$1 = "template2";
4546
declare const MergedSymbol$1 = "";
47+
declare var Variable$1: string;
4648
interface MergedSymbol$1 {
4749
test(): void;
4850
}
@@ -93,6 +95,8 @@ export {
9395
TEMPLATE$1 as TEMPLATE2,
9496
TypeName as T1,
9597
TypeName$1 as T2,
98+
Variable as V1,
99+
Variable$1 as V2,
96100
anotherFunc as af1,
97101
anotherFunc$1 as anotherFunc,
98102
func as f1,

0 commit comments

Comments
 (0)