Describe the bug
When an object is returned by asyncData, it is not added to CombinedVueInstance (like data() does). An error is thrown when ts type checking
import Vue from 'vue'
import { PoliticalMarket } from '@/entities/political.market.model'
export default Vue.extend({
asyncData({ params }): { id: string } {
return {
id: params.id
}
},
mounted() {
console.log(this.id)
}
})
````
```bash
ERROR: Property 'id' does not exist on type 'CombinedVueInstance<Vue, ... , Readonly<Record<never, any>>>'.
Expected behavior
Should add the property to CombinedVueInstance, like data() does
Screenshots


You'd need to duplicate those properties in data object.
data() {
return {
id: '',
}
}
@xavism Sorry, there is no support for this, Nuxt asyncData can't extend CombinedVueInstance which is a Vue complex type that already auto infers types from data, computed, etc...
As @rchl just stated, you need to set defaults and declare your types in data :
export default Vue.extend({
data() {
return {
id: '', // auto infers as `string` type,
nullableString: null as string | null,
someArrayOfStrings: [] as string[]
}
}
})
Perfect then! thank you both @rchl @kevinmarrec
Most helpful comment
You'd need to duplicate those properties in
dataobject.