// these type declarations are extracted and heavily simplified from the TypeScript "dom" library export function fetch(input: Request): Promise; export class Request { constructor(input: string, init?: RequestInit); readonly method: string; readonly url: string; } export interface RequestInit { body?: ArrayBufferView | ArrayBuffer | string | null; headers?: Headers; method?: string; } export class Headers { constructor(); append(name: string, value: string): void; delete(name: string): void; get(name: string): string | null; has(name: string): boolean; set(name: string, value: string): void; } export interface Body { readonly body: ReadableStream | null; arrayBuffer(): Promise; blob(): Promise; json(): Promise; text(): Promise; } export interface Response extends Body { readonly headers: Headers; readonly ok: boolean; readonly status: number; } export interface ReadableStream { cancel(reason?: any): Promise; getReader(): ReadableStreamDefaultReader; } export interface ReadableStreamGenericReader { cancel(reason?: any): Promise; } export interface ReadableStreamDefaultReader extends ReadableStreamGenericReader { read(): Promise>; } export type ReadableStreamReadResult = | {done: true, value?: T} | {done: false, value: T}