title: Incorrect types for Jest test.each
body: <p>So I'm using <a href="https://jestjs.io/docs/en/api#testeachtablename-fn-timeout" rel="nofollow noreferrer"><strong><code>Jest#test.each</code></strong></a> to run some unit tests.</p>
  
  <p>Here's the actual code:</p>
  
  <pre><code>const invalidTestCases = [
    [null, TypeError],
    [undefined, TypeError],
    [false, TypeError],
    [true, TypeError],
  ];
  
  describe('normalizeNames', () =&gt; {
    describe('invalid', () =&gt; {
      test.each(invalidTestCases)('some description for (%p, %p)', (actual, expected) =&gt; {
        expect(() =&gt; normalizeNames(actual as any)).toThrowError(expected);
      });
    });
  
    describe('valid', () =&gt; {
      // ...
    });
  });
  </code></pre>
  
  <p>The problem is that I'm unable to run this due to typescript errors:</p>
  
  <pre><code>Argument of type '(actual: boolean | TypeErrorConstructor | null | undefined, expected: boolean | TypeErrorConstructor | null | undefined) =&gt; void' is not assignable to parameter of type '(...args: (TypeErrorConstructor | null)[] | (TypeErrorConstructor | undefined)[] | (boolean | TypeErrorConstructor)[]) =&gt; any'.
        Types of parameters 'actual' and 'args' are incompatible.
          Type '(TypeErrorConstructor | null)[] | (TypeErrorConstructor | undefined)[] | (boolean | TypeErrorConstructor)[]' is not assignable to type '[boolean | TypeErrorConstructor | null | undefined, boolean | TypeErrorConstructor | null | undefined]'.
            Type '(TypeErrorConstructor | null)[]' is missing the following properties from type '[boolean | TypeErrorConstructor | null | undefined, boolean | TypeErrorConstructor | null | undefined]': 0, 1
             test.each(invalidTestCases)('some description for (%p, %p)', (actual, expected) =&gt; {
                                                         ~~~~~~~~~~~~~~~~~~~~~~~
  </code></pre>
  
  <hr>
  
  <p>I also tried to use an <code>array</code> of <code>objects</code> instead of 2d <code>array</code>, like this:</p>
  
  <pre><code>const invalidTestCases = [
    { actual: null, expected: TypeError },
    { actual: undefined, expected: TypeError },
    { actual: false, expected: TypeError },
    { actual: true, expected: TypeError },
  ];
  
  describe('normalizeNames', () =&gt; {
    describe('invalid', () =&gt; {
      test.each(invalidTestCases)('some description for (%p, %p)', ({ actual, expected }) =&gt; {
        expect(() =&gt; normalizeNames(actual as any)).toThrowError(expected);
      });
    });
  
    describe('valid', () =&gt; {
      // ...
    });
  });
  </code></pre>
  
  <p>...but doing this way, I can't get correct test description for <code>object</code> values.</p>