title: jest typescript - Mock Date constructor
body: <p>I'm trying to mock <code>new Date()</code> to return a specific date. The following code:</p>
  
  <pre><code>const now = new Date()
  jest.spyOn(global, 'Date').mockImplementation(() =&gt; now)
  </code></pre>
  
  <p>gives a compilation error: <code>Argument of type '() =&gt; Date' is not assignable to parameter of type '() =&gt; string'. Type 'Date' is not assignable to type 'string'</code>.</p>
  
  <p>I think the reason is that jest thinks I'm trying to mock <code>Date()</code> instead of <code>new Date()</code>. Indeed, <code>Date()</code> returns a string. How can I solve this issue?</p>