title: element implicitly has an 'any' type because type '{0}' has no index signature
body: <p>I want to set the <code>CanvasRenderingContext2D</code> context properties with given Object. But it always throws:</p>
  
  <blockquote>
    <p><strong>element implicitly has an 'any' type because type '{0}' has no index signature</strong></p>
  </blockquote>
  
  <p>How can I resolve this problem?</p>
  
  <pre class="lang-typescript prettyprint-override"><code>interface Attr {
    fillStyle: string | CanvasGradient | CanvasPattern;
    font: string;
    globalAlpha: number;
    lineCap: string;
    lineWidth: number;
    lineJoin: string;
    miterLimit: number;
    shadowBlur: number;
    shadowColor: string;
    strokeStyle: string;
    textAlign: string;
    textBaseline: string;
    lineDash: string;
  }
  
  const element: HTMLCanvasElement = &lt;HTMLCanvasElement&gt;document.querySelector('#c');
  const ctx: CanvasRenderingContext2D = element.getContext('2d');
  
  let attr:Partial&lt;Attr&gt; = {
    fillStyle: 'red',
    globalAlpha: 0.8
  }
  
  function setAttrs(target: CanvasRenderingContext2D, attr: Partial&lt;Attr&gt;) {
    for (let p in attr) {
      target[p] = attr[p];
    }
  }
  </code></pre>
  
  
  
  <p>VS Screenshot
  <a href="https://i.stack.imgur.com/wJ0By.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wJ0By.jpg" alt="vscode shortcut here"></a></p>