+return { emit }
+}
+
+})"
+`;
+
+exports[`SFC compile <script setup> with TypeScript defineEmits w/ type (interface ts type) 1`] = `
+"import { defineComponent as _defineComponent } from 'vue'
+interface Emits { (e: 'foo'): void }
+
+export default /*#__PURE__*/_defineComponent({
+ emits: ['foo'],
+ setup(__props, { expose, emit }) {
+ expose();
+
+
+
return { emit }
}
expect(content).toMatch(`emits: ["foo", "bar"]`)
})
+ // #5393
+ test('defineEmits w/ type (interface ts type)', () => {
+ const { content } = compile(`
+ <script setup lang="ts">
+ interface Emits { (e: 'foo'): void }
+ const emit: Emits = defineEmits(['foo'])
+ </script>
+ `)
+ assertCode(content)
+ expect(content).toMatch(`setup(__props, { expose, emit }) {`)
+ expect(content).toMatch(`emits: ['foo']`)
+ })
+
test('runtime Enum', () => {
const { content, bindings } = compile(
`<script setup lang="ts">