Skip to content

Commit b5314e5

Browse files
authored
Merge pull request #781 from live-codes/vue-template
edit Vue template to infer props from types
2 parents 28f0327 + 9269d30 commit b5314e5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/livecodes/templates/starter/vue-sfc-starter.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ import Counter from './Component.vue';
2727
<script setup lang="tsx">
2828
import { ref } from 'vue';
2929
30-
const props = defineProps({
31-
name: String
32-
})
30+
interface Props {
31+
name?: string
32+
}
33+
const props = defineProps<Props>();
3334
const count = ref(0);
3435
const align = 'center';
3536
3637
// define inline component
37-
function Greeting(props: {name?: string}) {
38+
function Greeting(props: Props) {
3839
return <h1>Hello, { props.name || 'World' }!</h1>
3940
}
4041
</script>

0 commit comments

Comments
 (0)