fix #4505
@@ -799,8 +799,8 @@ const emit = defineEmits(['a', 'b'])
<script setup lang="ts">
const props = withDefaults(defineProps<{
foo?: string
- bar?: number
- baz: boolean
+ bar?: number;
+ baz: boolean;
qux?(): number
}>(), {
foo: 'hi',
@@ -623,7 +623,8 @@ export function compileScript(
) +
', '
} else {
- res += scriptSetupSource.slice(m.start!, m.end!) + `, `
+ res +=
+ scriptSetupSource.slice(m.start!, m.typeAnnotation.end!) + `, `
}