title: type 'string' can't be used to index type 'unknown || or how to let typescript assign Type[key] = SameType[key]
body: <p>I have this helper function:</p>
  
  <pre><code>getAndAssignToObject&lt;T&gt;(key: string, objectToAssign: T): Promise&lt;T&gt; {
    const data = await AppStorage.get&lt;T&gt;(key);
    Object.keys(data).forEach( dataKey =&gt; {
      // @ts-ignore
      objectToAssign[dataKey] = data[dataKey];
    });
  
    return data;
  }
  </code></pre>
  
  <p>and is used in this way:</p>
  
  <pre><code>Helpers.getAndAssignToObject&lt;BlockingConfig&gt;(Components.BlockingRules, blockingData);
  </code></pre>
  
  <p>It works as expected but as you can see I have there a <code>@ts-ignore</code> that I would really like to remove.</p>
  
  <p>The errorI get when I remove it is :</p>
  
  <blockquote>
    <p>Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'unknown'.
      No index signature with a parameter of type 'string' was found on type 'unknown'   .ts(7053)</p>
  </blockquote>
  
  <p>and I do not know how to fix it. I tried to give <code>dataKey</code> the type <code>keyof T</code> but it didn't work.</p>