title: Jest mocking TypeScript class "No overload expects 1 type arguments"
body: <p>I'm trying to mock a TypeScript class with Jest and I'm obviously doing something because receive the following error:</p>
  
  <pre><code>error TS2743: No overload expects 1 type arguments, but overloads do exist that expect either 0 or 2 type arguments.
  </code></pre>
  
  <p>This is my code:</p>
  
  <p>Foo.ts</p>
  
  <pre><code>export default class Foo {
    bar(): number {
      return Math.random()
    }
  }
  </code></pre>
  
  <p>Foo.test.ts</p>
  
  <pre><code>import Foo from './Foo'
  
  describe('Foo', () =&gt; {
    it("should pass", () =&gt; {
      const MockFoo = jest.fn&lt;Foo&gt;(() =&gt; ({
        bar: jest.fn(() =&gt; {
          return 123
        }),
      }))
    })
  })
  </code></pre>
  
  <p>The full error:</p>
  
  <pre><code>TypeScript diagnostics (customize using `[jest-config].globals.ts-jest.diagnostics` option):
  src/Foo.test.ts:6:29 - error TS2743: No overload expects 1 type arguments, but overloads do exist that expect either 0 or 2 type arguments.
  
  6     const MockFoo = jest.fn&lt;Foo&gt;(() =&gt; ({
                                ~~~
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>If it is of any relevance, this is my Jest config:</p>
  
  <pre><code>module.exports = {
    moduleFileExtensions: ['ts', 'js'],
    transform: {
      '^.+\\.ts$': 'ts-jest',
    },
    testMatch: ['**/src/**/*.test.(ts)'],
    testEnvironment: 'node',
  };
  </code></pre>