jest-fetch-mock
jest-fetch-mock copied to clipboard
jest.mock Property is not visible in the TypeScript headers.
In the examples I can see things like:
expect(fetch.mock.calls.length).toEqual(1) expect(fetch.mock.calls[0][0]).toEqual('https://google.com')
unfortunately this is not defined in the typescript files.
I can see that its defined on MockInstance, but I fail to make it accessible. Is there any trick that it needs to be imported?
I think the problem is the FetchMock is defined as:
export interface FetchMock extends jest.MockInstance<any> {
But the jest type has two generics:
interface MockInstance<T, Y extends any[]> {
Changing the FetchMock definition to:
export interface FetchMock extends jest.MockInstance<any, any> {
fixes the issue
This is a duplicate to #108