title: Dynamic call of chalk with typescript
body: <p>I am using typescript and want to call the chalk method dynamically, see my code :</p>
  <pre class="lang-js prettyprint-override"><code>import chalk from 'chalk';
  
  const color: string = &quot;red&quot;;
  const message: string = &quot;My Title&quot;;
  const light: boolean = false;
  
  const colorName = `bg${capitalize(color)}${light ? 'Bright' : ''}`;
  console.log(chalk[colorName](message));
  </code></pre>
  <p>So, the color function takes as a value the color of the background of the message. The message is the content and the light is the boolean used to know if the background should have its bright version used.<br />
  The problem is that typescript throws this error :</p>
  <pre><code>Element implicitly has an 'any' type because expression of type 'any' can't be used to index type 'ChalkInstance'.
  </code></pre>
  <p>on the <code>chalk[colorName]</code> part.</p>
  <p>I already tried to put <code>(chalk[colorName] as keyof ChalkInstance)</code>. And already looked at <a href="https://stackoverflow.com/questions/58389081/typescript-error-when-dynamically-setting-color-for-chalk-package">this post</a> (which is the basically the same problem). Obviously, the solutions answered aren't working with my case.</p>