FetchEvent
import type { FetchEvent } from "https://raw.githubusercontent.com/worker-tools/middleware/master/index.ts";
This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.
interface FetchEvent extends ExtendableEvent {
readonly clientId: string;
readonly handled: Promise<void>;
readonly preloadResponse: Promise<any>;
readonly replacesClientId: string;
readonly request: Request;
readonly resultingClientId: string;
respondWith(r: Response | Promise<Response>): void;
}