Answer the question
In order to leave comments, you need to log in
Why does Nuxt + TypeScript give an error?
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
data() {
return {
tag: this.$route.params.tag
}
},
})
</script>
any
Property '$route' does not exist on type 'Readonly<Record<never, any>> & Vue'.Vetur(2339)
Answer the question
In order to leave comments, you need to log in
Did you use the instruction or did you just randomly connect TypeScript to Nuxt?
The fact is that Nuxt connects a lot of things implicitly, incl. and router, so TypeScript is unaware that Vue
additional type properties have been added to the type $route
. It is necessary to connect declarations separately manually, or follow the instructions above.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question