Skip to content

Commit b744f4a

Browse files
committed
Skip import type when skipTypeImports is true
1 parent 8712275 commit b744f4a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

index.js

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = function(src, options = {}) {
1616

1717
// Determine whether to skip "type-only" imports
1818
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html#import-types
19+
// https://www.typescriptlang.org/v2/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export
1920
const skipTypeImports = Boolean(options.skipTypeImports);
2021
// Remove skipTypeImports option, as this option may not be recognized by the walker/parser
2122
delete walkerOptions.skipTypeImports;
@@ -43,6 +44,9 @@ module.exports = function(src, options = {}) {
4344
}
4445
break;
4546
case 'ImportDeclaration':
47+
if (skipTypeImports && node.importKind == 'type') {
48+
break;
49+
}
4650
if (node.source && node.source.value) {
4751
dependencies.push(node.source.value);
4852
}

0 commit comments

Comments
 (0)