Skip to content

Commit d7f4074

Browse files
committed
fix: declaration files inconsistencies
related #24, #23, #22
1 parent cf20a3f commit d7f4074

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const transformer = (_: ts.Program) => (context: ts.TransformationContext) => (
1212
const compilerOptions = context.getCompilerOptions();
1313
const sourceDir = dirname(sourceFile.fileName);
1414

15+
const { isDeclarationFile } = sourceFile;
16+
1517
const { baseUrl = "", paths = {} } = compilerOptions;
1618

1719
const binds = Object.keys(paths)
@@ -39,6 +41,7 @@ const transformer = (_: ts.Program) => (context: ts.TransformationContext) => (
3941

4042
function visit(node: ts.Node): ts.VisitResult<ts.Node> {
4143
if (
44+
!isDeclarationFile &&
4245
resolver &&
4346
ts.isExportDeclaration(node) &&
4447
!node.exportClause &&
@@ -74,7 +77,7 @@ const transformer = (_: ts.Program) => (context: ts.TransformationContext) => (
7477
visitImportClause as any,
7578
ts.isImportClause
7679
);
77-
return node.importClause === importClause || importClause
80+
return node.importClause === importClause || importClause || isDeclarationFile
7881
? ts.updateImportDeclaration(
7982
node,
8083
node.decorators,

0 commit comments

Comments
 (0)