error TS2339: Property 'x' does not exist on type 'Y'
<p>I don't understand why this code generates TypeScript error.
(It's not the original code and is a bit derived, so please ignore the non-sense in the example):</p>

<pre class="lang-js prettyprint-override"><code>interface Images {
  [key:string]: string;
}

function getMainImageUrl(images: Images): string {
  return images.main;
}
</code></pre>

<p>I'm getting error (using TypeScript 1.7.5):</p>

<blockquote>
  <p>error TS2339: Property 'main' does not exist on type 'Images'.</p>
</blockquote>

<p>Of course I could get rid of the error when writing:</p>

<pre><code>return images["main"];
</code></pre>

<p>I'd prefer not using string to access the property. What can I do?</p>