})"
`;
+exports[`SFC compile <script setup> with TypeScript import type 1`] = `
+"import { defineComponent as _defineComponent } from 'vue'
+import type { Foo } from './main.ts'
+ import { type Bar, Baz } from './main.ts'
+
+export default /*#__PURE__*/_defineComponent({
+ setup(__props, { expose }) {
+ expose();
+
+
+return { Baz }
+}
+
+})"
+`;
+
exports[`SFC compile <script setup> with TypeScript runtime Enum 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
enum Foo { A = 123 }
Foo: BindingTypes.SETUP_CONST
})
})
+
+ test('import type', () => {
+ const { content } = compile(
+ `<script setup lang="ts">
+ import type { Foo } from './main.ts'
+ import { type Bar, Baz } from './main.ts'
+ </script>`
+ )
+ expect(content).toMatch(`return { Baz }`)
+ assertCode(content)
+ })
})
describe('async/await detection', () => {
node.source.value,
specifier.local.name,
imported,
- node.importKind === 'type',
+ node.importKind === 'type' ||
+ (specifier.type === 'ImportSpecifier' &&
+ specifier.importKind === 'type'),
false
)
}
source,
local,
imported,
- node.importKind === 'type',
+ node.importKind === 'type' ||
+ (specifier.type === 'ImportSpecifier' &&
+ specifier.importKind === 'type'),
true
)
}