Skip to content

Commit 7c1f54e

Browse files
authored
Assume clause-less imports to be unemittable (#1198)
1 parent 79b2727 commit 7c1f54e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

internal/ast/utilities.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3106,7 +3106,7 @@ func IsPartOfExclusivelyTypeOnlyImportOrExportDeclaration(node *Node) bool {
31063106
func IsEmittableImport(node *Node) bool {
31073107
switch node.Kind {
31083108
case KindImportDeclaration:
3109-
return node.AsImportDeclaration().ImportClause == nil || !node.AsImportDeclaration().ImportClause.IsTypeOnly()
3109+
return node.AsImportDeclaration().ImportClause != nil && !node.AsImportDeclaration().ImportClause.IsTypeOnly()
31103110
case KindExportDeclaration:
31113111
return !node.AsExportDeclaration().IsTypeOnly
31123112
case KindImportEqualsDeclaration:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// @strict: true
2+
// @verbatimModuleSyntax: true,false
3+
// @noUncheckedSideEffectImports: true,false
4+
// @noEmit: true
5+
// @noTypesAndSymbols: true
6+
7+
// https://github.com/microsoft/typescript-go/issues/1190
8+
9+
// @filename: /types.d.ts
10+
export type MyType = { foo: string; };
11+
12+
// @filename: /index.ts
13+
import "./types.d.ts";

0 commit comments

Comments
 (0)