Skip to content

Commit

Permalink
fix: Certain edge cases existed where type elision improperly elided …
Browse files Browse the repository at this point in the history
…full import / export declarations without named bindings (closes #87)
  • Loading branch information
nonara committed Jan 4, 2021
1 parent 47f9d64 commit 0befbe5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export function nodeVisitor(this: VisitorContext, node: ts.Node): ts.Node | unde
return resolvePathAndUpdateNode(this, node, node.moduleSpecifier.text, (p) => {
let importClause = node.importClause;

if (!this.isDeclarationFile && importClause) {
if (!this.isDeclarationFile && importClause?.namedBindings) {
const updatedImportClause = elideImportOrExportClause(this, node);
if (!updatedImportClause) return undefined; // No imports left, elide entire declaration
importClause = updatedImportClause;
Expand All @@ -127,7 +127,7 @@ export function nodeVisitor(this: VisitorContext, node: ts.Node): ts.Node | unde
return resolvePathAndUpdateNode(this, node, node.moduleSpecifier.text, (p) => {
let exportClause = node.exportClause;

if (!this.isDeclarationFile && exportClause) {
if (!this.isDeclarationFile && exportClause && tsInstance.isNamedExports(exportClause)) {
const updatedExportClause = elideImportOrExportClause(this, node);
if (!updatedExportClause) return undefined; // No export left, elide entire declaration
exportClause = updatedExportClause;
Expand Down

0 comments on commit 0befbe5

Please sign in to comment.