I am having trouble resolving this error on my app. Essentially, I have an interface set as so:
interface skuInfo {
href: string
}
interface myObjectItem {
itemId: string
isFound: boolean
price: {
selling: number
}
images: {
sku: skuInfo[]
}
}
What trips me is the myObjectItem.images.sku.
I have an object set as so: const exObj: myObjectItem.
When I try to access its property:
exObj.images.sku[0].href, I receive the following error:
Property 'href' does not exist on type 'object'
In my Visual Code editor, I can see that it prefills the href attribute when accessing an array of the object, but TS is still complaining.
Am I missing something?
Based on your interface, the property access should be
So, typescript is right, your images object doesn't have
hrefpropertyCheck this playground, your error won't reproduces.