Mock dependency in jest with typescript : <p>When testing a module that has a dependency in a different file. When assigning that module to be <code>jest.Mock</code> typescript gives an error that the method <code>mockReturnThisOnce</code>(or any other jest.Mock method) does not exist on the dependency, this is because it is previously typed. What is the proper way to get typescript to inherit the types from jest.Mock?</p>

<p>Here is a quick example.</p>

<p>Dependency</p>

<pre><code>const myDep = (name: string) =&gt; name;
export default myDep;
</code></pre>

<p>test.ts</p>

<pre><code>import * as dep from '../depenendency';
jest.mock('../dependency');

it('should do what I need', () =&gt; {
  //this throws ts error
  // Property mockReturnValueOnce does not exist on type (name: string)....
  dep.default.mockReturnValueOnce('return')
}
</code></pre>

<p>I feel like this is a very common use case and not sure how to properly type this. Any help would be much appreciated! </p>
