node-webpush 🔔
    Preparing search index...

    Type Alias FetchLike

    FetchLike: (
        input: string | URL,
        init?: FetchLikeInit,
    ) => Promise<FetchLikeResponse>

    A fetch-like function. Deliberately looser than typeof fetch for the same reason as FetchLikeResponse - so alternatives like undici's fetch (or any other spec-compliant implementation) are assignable as-is. input is narrowed to string | URL (dropping Request) because that's genuinely all notify() ever passes - generateRequest()'s endpoint is always a plain string - and lib.dom's Request vs. undici's own aren't mutually assignable (undici's requires duplex), which would otherwise force a consumer-side cast for no real gain: nothing here ever constructs a Request object.

    A plain FetchLikeInit (not the global RequestInit) for the same reason, and to keep generateRequest()'s own return type consistent with what gets passed to it - see FetchLikeInit. generateRequest()'s returned init is usable as a real RequestInit unchanged (its fields are a subset). The other direction - a value typed typeof fetch isn't structurally assignable to FetchLike, purely a TS/Node generic-Uint8Array version quirk on body, not a real runtime mismatch - is why WebPush adapts the global fetch through one small wrapper internally (see defaultFetch in webpush.ts) rather than relying on that assignability here.

    Type Declaration