I don't understand why this code generates a TypeScript error. (It's not the original code and is a bit derived, so please ignore the non-sense in the example):
interface Images {
[key:string]: string;
}
function getMainImageUrl(images: Images): string {
return images.main;
}
I'm getting this error (using TypeScript 1.7.5):
error TS2339: Property 'main' does not exist on type 'Images'.
Of course I could get rid of the error by writing:
return images["main"];
I'd prefer to not use string to access the property. What can I do?
{{display_vari_price}}
Price : {{ slide.price }}
Offer Price :{{slide.saleprice}}