title: Jest spyOn not working with typescript: "Property 'mockRestore' is missing in type 'Spy'"
body: <p>When using <a href="https://jestjs.io/docs/en/jest-object#jestspyonobject-methodname" rel="noreferrer">spyOn</a> with jest and typescript I am getting this type error:</p>
  
  <blockquote>
    <p>Type 'Spy' is not assignable to type 'SpyInstance&lt;{}>'.  Property
    'mockRestore' is missing in type 'Spy'.</p>
  </blockquote>
  
  <p>Here is a code example that causes it: </p>
  
  <pre><code>class A {
    foo = () =&gt; this.bar() + 1;
    bar = () =&gt; 1;
  }
  
  test('should pass', () =&gt; {
    const a = new A();
    let barSpy: jest.SpyInstance;
    barSpy = spyOn(a, 'bar');
    a.foo();
    expect(barSpy).toHaveBeenCalled();
  });
  </code></pre>
  
  <p>When I run this example the test passes, but the typescript complier fails. </p>