Hello,
I have a gallery on my product page that I am populating using the following code.
async function productDisplay() {
// Set the global product variable to the currently displayed product.
product = await $w('#productPage1').getProduct();
let prodGal = product.mediaItems
$w('#prodGallery').items = prodGal
The thing is the $w(‘#prodGallery’).items has a red underline and says the following.
Type ‘MediaItem’ is not assignable to type ‘ImageItem[] | VideoItem[]’. Type ‘MediaItem’ is missing the following properties from type ‘VideoItem[]’: length, pop, push, concat, and 30 more. It’s recommended you use a new variable, such as “let newVar = …” to make sure that all code completion work correctly.
The weird thing is it works but it is super slow it loads long after the rest of the page loads. I need to speed it up so I am thinking fixing this error might be the answer.
I am not sure what to do to fix this I have tried changing it to .images and a few other things.
Thanks in advance!