fetch-wrap
fetch-wrap copied to clipboard
Add TypeScript support
I wonder how one could make this a little bit more type-safe by having the middleware actually know the types of the arguments and the supposed return value (Promose<Response>
).
I have started with this:
// This should be exported by "fetch-wrap" as a type
type FetchFunction = typeof fetch
export function logHeaders() {
return function(url: string, options:RequestInit = {}, fetch: FetchFunction):Promise<Response> {
}
}