File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ module.exports = function addImports(root, _statements) {
6969 decl . importKind = null
7070 }
7171 specifier . importKind = specifierImportKind
72+ } else if (
73+ decl . importKind !== 'value' &&
74+ decl . importKind === specifierImportKind
75+ ) {
76+ specifier . importKind = null
7277 }
7378 decl . specifiers . push ( specifier )
7479 } else {
Original file line number Diff line number Diff line change @@ -395,5 +395,16 @@ import baz from 'baz'
395395import blah, { type qux } from "qux";
396396` )
397397 } )
398+ describe ( `bugs` , function ( ) {
399+ it ( `import type { foo, type bar }` , function ( ) {
400+ const code = `// @flow
401+ import type { foo } from 'foo'`
402+ const root = j ( code )
403+ const result = addImports ( root , statement `import {type bar} from 'foo'` )
404+ expect ( result ) . to . deep . equal ( { bar : 'bar' } )
405+ expect ( root . toSource ( ) ) . to . equal ( `// @flow
406+ import type { foo, bar } from 'foo';` )
407+ } )
408+ } )
398409 } )
399410} )
You can’t perform that action at this time.
0 commit comments