export interface Options { /** * Setting this to true will yield an array. In other words; instead of yielding once for every payload—we collect * all complete payloads for a chunk and then yield. * * @default false */ multiple: boolean; } export type Part = | { json: false; headers: Record; body: Fallback } | { json: true; headers: Record; body: Body }; // TODO: is there a way to compose the `meros/{node,browser}` here without having to duplicate the entire signature? And maintain jsdocs // -- NODE import type { IncomingMessage } from 'node:http'; export function meros( response: IncomingMessage, options: { multiple: true }, ): Promise>>>; export function meros( response: IncomingMessage, options?: { multiple: false }, ): Promise>>; export function meros( response: IncomingMessage, options?: Options, ): Promise>>; // -- BROWSER export function meros( response: Response, options: { multiple: true }, ): Promise>>>; export function meros( response: Response, options?: { multiple: false }, ): Promise>>; export function meros( response: Response, options?: Options, ): Promise>>;