title: How do you patch objects in TypeScript?
body: <p>I have a module that patches <a href="https://github.com/chalk/chalk" rel="nofollow noreferrer"><code>chalk</code></a> colors for my specific needs. Here's the code:</p>
  
  <pre><code>import { ChalkStyleElement, ChalkStyleMap, styles } from 'chalk';
  import escape from './escape';
  
  /**
   * Decorate ASCII-colors with shell-specific escapes
   */
  let PatchedChalkStyleMap: ChalkStyleMap;
  
  Object.keys(styles).forEach((style: string) =&gt; {
    PatchedChalkStyleMap[style] = {
      close: escape(styles[style].close),
      open: escape(styles[style].open),
      reset: escape(styles[style].reset),
    };
  });
  </code></pre>
  
  <p>Above I just walk through all of <code>chalk</code> styles and patch them with my special <code>escape</code> function. However, this wouldn't compile. I get these errors:</p>
  
  <pre><code>src/colors.ts(10,3): error TS7017: Element implicitly has an 'any' type because type 'ChalkStyleMap' has no index signature.
  src/colors.ts(11,16): error TS7017: Element implicitly has an 'any' type because type 'ChalkStyleMap' has no index signature.
  src/colors.ts(12,15): error TS7017: Element implicitly has an 'any' type because type 'ChalkStyleMap' has no index signature.
  src/colors.ts(13,16): error TS7017: Element implicitly has an 'any' type because type 'ChalkStyleMap' has no index signature
  </code></pre>
  
  <p>Also, I should say I have <code>"noImplicitAny"</code> options enabled in my <code>tsconfig.json</code>.</p>
  
  <p>How can I describe types here correctly, without getting implicit <code>any</code>?</p>