Hey, I know that vetur support Intellisense like mentioned here https://vuejs.github.io/vetur/intellisense.html . But it doesn't support for setup yet. Which is used for vue-function-api
Here's the code I tried
<template>
<div class="home">
<img alt="Vue logo" src="../assets/logo.png" />
<HelloWorld msg="Welcome to Your Vue.js + TypeScript App" />
<div>
<span>count is {{ count }}</span>
<span>plusOne is {{ plusOne}}</span>
<button @click="increment">count++</button>>
</div>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
import { value, computed, watch, onMounted } from 'vue-function-api'
import HelloWorld from '@/components/HelloWorld.vue' // @ is an alias to /src
export default Vue.extend({
setup() {
const count = value(0)
const plusOne = computed(() => count.value)
const increment = () => {
count.value++
}
watch(
() => count.value * 2,
val => {
console.log(`count * 2 is ${val}`)
}
)
onMounted(() => {
console.log(`mounted`)
})
return {
count,
plusOne,
increment
}
},
name: 'home',
components: {
HelloWorld
}
})
</script>
I still don't get the intellisense auto complete for count, plusOne, and increment.
Thanks for developing this extension btw. :)
I guess it's impossible to support vue-function-api because there is no way to extend Vue instance type from plugins. This is known limitation for current Vue's typings. (ref #1226 )
We will be able to support setup and declared properties by it in Vue v3.
Hey there 馃憢
Would that be possible to add few JSDoc comments to our component to make it works in the meanwhile?
I think that's an outdated issue.
The new @vue/composition-api is work well for me
Most helpful comment
I guess it's impossible to support
vue-function-apibecause there is no way to extend Vue instance type from plugins. This is known limitation for current Vue's typings. (ref #1226 )We will be able to support
setupand declared properties by it in Vue v3.