title: Runtime error in jest - TypeError: Class extends value undefined is not a constructor or null
body: <p>I have a typescript file defined like so:</p>
  <pre><code>// myType.tsx
  
  import { Foo } from 'foo';
  [...]
  export interface MyType extends IDisposable {
  [...]
  }
  
  export abstract class MyTypeBase implements MyType {
    innerFoo: Foo | null | undefined;
    get foo(): Foo {
      return this.innerFoo;
    }
  
    [...]
  }
  </code></pre>
  <p>I am trying to test another class which depends on this <code>MyType</code>, and I want to mock out the <code>foo()</code> getter.</p>
  <p>In my test file, once I add the following to the file:</p>
  <pre><code>[...]
  import { MyType } from 'path/to/MyType';
  [...]
  jest.mock('path/to/MyType', () =&gt; {
    return jest.fn().mockImplementation(() =&gt; {
      return {foo: () =&gt; mockFoo}; //mockFoo is defined earlier in the file.
    })
  });
  </code></pre>
  <p>I get an error when running the test:
  <code>Class extends value undefined is not a constructor or null</code></p>
  <p>This only occurs when I include the <code>jest.mock(...)</code> line.</p>
  <p>From other questions related, I see this can be caused by circular dependencies, but I'm failing to see how that can introduced by a call to <code>jest.mock</code>? I can see that other breakpoints that are hit when I comment out this code are not being hit, so it appears as though adding this mock is causing my test to fail early for this reason.</p>
  <p>Anyone come across this before?</p>