Skip to content

Commit e6fe751

Browse files
authored
fix(compile-sfc): generate setup prop type format error (#4506)
fix #4505
1 parent 0178f4e commit e6fe751

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/compiler-sfc/__tests__/compileScript.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,8 @@ const emit = defineEmits(['a', 'b'])
799799
<script setup lang="ts">
800800
const props = withDefaults(defineProps<{
801801
foo?: string
802-
bar?: number
803-
baz: boolean
802+
bar?: number;
803+
baz: boolean;
804804
qux?(): number
805805
}>(), {
806806
foo: 'hi',

packages/compiler-sfc/src/compileScript.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,8 @@ export function compileScript(
623623
) +
624624
', '
625625
} else {
626-
res += scriptSetupSource.slice(m.start!, m.end!) + `, `
626+
res +=
627+
scriptSetupSource.slice(m.start!, m.typeAnnotation.end!) + `, `
627628
}
628629
}
629630
}

0 commit comments

Comments
 (0)