Block object extension help

I have this code that uses the blockMenu and blockObject extensions:

let regular_image: Image = blockObject.getImageProperty(shop_list[blockMenu.selectedMenuIndex()], ImageProp.regular_image)

Which gives me this error:

Element implicitly has an 'any' type because type 'BlockObject' has no index signature.

What to do?

shop_list is defined as:

let shop_list: blockObject.BlockObject = []  // List of blockObject.BlockObjects returned from a function

Here is the share link:

Shop list is an array of BlockObjects, not a single block objects; it should be defined like this, with [] at the end to indicate it is an array: image

1 Like