title: Type declarations for function calling lodash `mapKeys`
body: <p>I need a function mapping <strong>camelCase</strong> object keys to <strong>snakeCase</strong>. I want to use it multiple times with different objects.</p>
  
  <p>I wrote function <code>mapKeysToSnakeCase</code> that works well, but I wonder if there is possible to use generic types instead of <code>any</code> to improve the definition.</p>
  
  <p><em>Any advice how it can be done?</em></p>
  
  <pre><code>export function mapKeysToSnakeCase(data: any): any {
      return mapKeys(data, (value, key) =&gt; snakeCase(key));
  }
  </code></pre>
  
  <p>Before:</p>
  
  <pre><code>const camelCase = {
      firstName: 'John',
      lastName: 'Smith',
  };
  </code></pre>
  
  <p>After:</p>
  
  <pre><code>const snakeCase = {
      first_name: 'John',
      last_name: 'Smith',
  };
  </code></pre>
  
  <hr>
  
  <p><strong>@edit</strong></p>
  
  <p>I tried previously with new type definition (like first answer suggested), but I end up with warning in usage context and it is why I want to use some generic types for it.</p>
  
  <pre><code>sync getData(): Promise&lt;X&gt; {
      (...)
      return mapKeysToSnakeCase(camelCaseX);
  }
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>TS2741: Property 'first_name' is missing in type 'KV' but required in type 'X'.
  </code></pre>