I'm writing a NuxtJS (Vue) component that uses props with TypeScript.
I followed the example presented within the documentation, but ESLint brings out an error that is not supposed to be there.
There doesn't seem to be any syntax errors from what I have gathered and the ESLint rule that is required to solve this error is nowhere to be found from my google searches.
<template>
<a :href="this.button.buttonLink">
<p v-bind="this.button.buttonText"/>
<img src="@/static/assets/icons/smallArrow.svg" />
</a>
</template>
<script lang="ts">
import Vue, { PropOptions } from 'vue'
interface Button {
buttonText: string,
buttonLink: string
}
export default Vue.extend({
name: 'ButtomComponent',
props: {
button: {
type: Object,
required: true
} as PropOptions<Button>
}
})
</script>
The expected outcome should be a normal render of the component. But I get the following:
Parsing error: Unexpected token, expected ","
14 | type: Object,
15 | required: true
> 16 | } as PropOptions<Button>
| ^
17 | }
18 | })
19 |eslint
Fixed I resolved the issue by commenting(you can remove completely) Babel-eslint from parserOptions within the eslint config file.
parserOptions: {
// parser: 'babel-eslint'
},