kwhitley / itty-fetcher

An even simpler wrapper around native Fetch to strip boilerplate from your fetching code!
MIT License
99 stars 4 forks source link

Export the FetcherType #20

Closed Crisfole closed 2 years ago

Crisfole commented 2 years ago

Exporting the FetcherType allows you to wrap itty-fetcher more easily:

export function api(args: Args): FetcherType {
  return fetcher({
    ...args,
    base: args.base.replace("/dev", "/prod"),
  });
}

That's a terrible example, but the core need is reasonable, especially if you're using other functions that expect to receive the FetcherType as a param (which I assume is going to be all over the place).

kwhitley commented 2 years ago

Looks good to me! Good suggestion! :)