我正在使用打字稿构建nuxt.js应用。这是我的代码:
<script lang='ts'>
import {Component, Vue} from 'nuxt-property-decorator';
import {LOCATION} from '~/constants/graphql/location';
@Component({
apollo: {
getLocation: {
query: LOCATION,
variables(): object {
return {
id: 10,
};
},
prefetch: true,
},
},
})
export default class Home extends Vue {
}
</script>
我有错误:
Argument of type '{ apollo: { getLocation: { query: any; variables(): object; prefetch: boolean; }; }; }' is not assignable to parameter of type 'VueClass<Vue>'.
对象文字只能指定已知的属性,并且'apollo'在'VueClass'类型中不存在。
我知道它来自TS,但如何解决?