jefflau / jest-fetch-mock

Jest mock for fetch
MIT License
881 stars 116 forks source link

3.0.3 seems to have incorrect typings #206

Open keeganwatkins opened 3 years ago

keeganwatkins commented 3 years ago

The types include this definition:

// Truncated for brevity
export interface FetchMock {
  (input?: string | Request, init?: RequestInit): Promise<Response>;
}

but in the spec, input cannot be undefined.

In Chrome, fetch() (invoked without arguments) produces a TypeError:

Failed to execute 'fetch' on 'Window': 1 argument required, but only 0 present.
keeganwatkins commented 3 years ago

I took a pass at resolving this in https://github.com/jefflau/jest-fetch-mock/pull/207, I've not contributed to this project before so please let me know what I can do to help 😄