Closed
Description
App.vue:
<template>
<div @click="count++">{{ count }}</div>
</template>
<script setup lang="ts">
import { ref, Ref } from 'vue';
const count: Ref<number> = ref(0);
</script>
I see that explicitly defining the Ref<number>
type is not necessary, but this is just an example. VSCode shows an error in the import
statement:
Which is not actually an error because the imported type Ref
is not being used as a value anywhere. This doesn't happen if we rewrite this code without using <script setup>
:
<template>
<div @click="count++">{{ count }}</div>
</template>
<script lang="ts">
import { defineComponent, ref, Ref } from 'vue';
export default defineComponent({
setup() {
const count: Ref<number> = ref(0);
return {
count,
};
},
});
</script>