Skip to content

Commit cfc85ae

Browse files
cspotcodebuehler
authored andcommitted
fix: don't rename double underscored symbols
Fixes #35, Fixes #24
1 parent bf77662 commit cfc85ae

File tree

5 files changed

+36
-3
lines changed

5 files changed

+36
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@
4747
"dependencies": {
4848
"lodash": "^4.17.4",
4949
"tslib": "^1.7.1",
50-
"typescript": "2.4.2"
50+
"typescript": "^2.5.3"
5151
}
5252
}

src/DeclarationIndex.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class DeclarationIndex {
118118
*/
119119
public get declarationInfos(): DeclarationInfo[] {
120120
return Object
121-
.keys(this.index)
121+
.keys(this.index!)
122122
.sort()
123123
.reduce((all, key) => all.concat(this.index![key]), <DeclarationInfo[]>[]);
124124
}

test/TypescriptParser.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('TypescriptParser', () => {
5151
});
5252

5353
it('should parse imports', () => {
54-
expect(parsed.imports).toHaveLength(9);
54+
expect(parsed.imports).toHaveLength(12);
5555
expect(parsed.imports).toMatchSnapshot();
5656
});
5757

test/__snapshots__/TypescriptParser.spec.ts.snap

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,36 @@ Array [
10121012
],
10131013
"start": 400,
10141014
},
1015+
NamedImport {
1016+
"defaultAlias": "__DefaultAlias",
1017+
"end": 540,
1018+
"libraryName": "namedImport",
1019+
"specifiers": Array [
1020+
SymbolSpecifier {
1021+
"alias": "__Specifier1",
1022+
"specifier": "Specifier1",
1023+
},
1024+
],
1025+
"start": 456,
1026+
},
1027+
NamedImport {
1028+
"defaultAlias": "__DefaultAlias",
1029+
"end": 614,
1030+
"libraryName": "namedImport",
1031+
"specifiers": Array [
1032+
SymbolSpecifier {
1033+
"alias": "__Specifier1",
1034+
"specifier": "Specifier1",
1035+
},
1036+
],
1037+
"start": 541,
1038+
},
1039+
NamespaceImport {
1040+
"alias": "__namespaceImport",
1041+
"end": 662,
1042+
"libraryName": "namespace",
1043+
"start": 615,
1044+
},
10151045
]
10161046
`;
10171047

test/_workspace/typescript-parser/importsOnly.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ import {
1010
import Foobar from 'aFile';
1111
import { default as DefaultAlias, Specifier1 } from 'namedImport';
1212
import DefaultAlias, { Specifier1 } from 'namedImport';
13+
import { default as __DefaultAlias, Specifier1 as __Specifier1 } from 'namedImport';
14+
import __DefaultAlias, { Specifier1 as __Specifier1 } from 'namedImport';
15+
import * as __namespaceImport from 'namespace';

0 commit comments

Comments
 (0)