}"
`;
+exports[`SFC compile <script setup> with TypeScript const Enum 1`] = `
+"import { defineComponent as _defineComponent } from 'vue'
+const enum Foo { A = 123 }
+
+export default _defineComponent({
+ setup(__props, { expose }) {
+ expose()
+
+
+return { Foo }
+}
+
+})"
+`;
+
exports[`SFC compile <script setup> with TypeScript defineEmits w/ type (exported interface) 1`] = `
"import { defineComponent as _defineComponent } from 'vue'
export interface Emits { (e: 'foo' | 'bar'): void }
Foo: BindingTypes.SETUP_CONST
})
})
+
+ test('const Enum', () => {
+ const { content, bindings } = compile(
+ `<script setup lang="ts">
+ const enum Foo { A = 123 }
+ </script>`
+ )
+ assertCode(content)
+ expect(bindings).toStrictEqual({
+ Foo: BindingTypes.SETUP_CONST
+ })
+ })
})
describe('async/await detection', () => {
if (isTS) {
// runtime enum
- if (node.type === 'TSEnumDeclaration' && !node.const) {
+ if (node.type === 'TSEnumDeclaration') {
registerBinding(setupBindings, node.id, BindingTypes.SETUP_CONST)
}