export type FetchMock = (input: RequestInfo | URL, init?: RequestInit) => Promise; type FetchPreconnectOptions = { dns?: boolean; tcp?: boolean; http?: boolean; https?: boolean; }; type FetchWithPreconnect = { preconnect: (url: string | URL, options?: FetchPreconnectOptions) => void; }; export function withFetchPreconnect(fn: T): T & FetchWithPreconnect; export function withFetchPreconnect( fn: T, ): T & FetchWithPreconnect & typeof fetch; export function withFetchPreconnect(fn: object) { return Object.assign(fn, { preconnect: (_url: string | URL, _options?: FetchPreconnectOptions) => {}, }); }