title: Assign properties from an object to another object in typescript
body: <p>I two objects with many properties. I want to copy properties from one object to the other only if it's defined.</p>
  <p>Here is the object interface:</p>
  <pre><code>interface Settings {
    locale: string;
    currency: string;
    style: string;
    isDark: boolean;
    // There are more fields here
  }
  </code></pre>
  <p>The two objects are defined like this:</p>
  <pre><code>const settings: Settings = {/*assign all fields here*/}
  const settingsChange: Partial&lt;Settings&gt; = {/*change some fields*/}
  </code></pre>
  <p>Now I need to assign the fields in <code>settingsChange</code> to <code>settings</code>, I am trying to do this just like I were to do it in javascript</p>
  <pre><code>Object.entries(settingsChange).forEach(([key, value])=&gt;{
    settings[key] = settingsChange[key] || settings[key]
  })
  </code></pre>
  <p>Here is the typescript linting error I receive:</p>
  <pre><code>Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Settings'.
  No index signature with a parameter of type 'string' was found on type 'Settings'.ts(7053)
  </code></pre>
  <p>How do I solve this ? I know that <code>Object.assign</code> would work but <code>Object.entries</code> gives me more freedom to apply whatever logic I need.</p>