domain-tasks fetch lacks response type information #194

Closed
opened 2025-08-09 17:15:21 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @RyanLamansky on 2/1/2018

The domain-tasks library has fetch returning Promise<any>, but should return a well-defined structure as the one found in lib.dom.d.ts:

Excerpt from that file:

interface Response extends Object, Body {
    readonly body: ReadableStream | null;
    readonly headers: Headers;
    readonly ok: boolean;
    readonly status: number;
    readonly statusText: string;
    readonly type: ResponseType;
    readonly url: string;
    readonly redirected: boolean;
    clone(): Response;
}

declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;

If it's intended to wrap the common fetch function perfectly, it should directly reference the types from lib.dom.d.ts.

*Originally created by @RyanLamansky on 2/1/2018* The domain-tasks library has `fetch` returning `Promise<any>`, but should return a well-defined structure as the one found in lib.dom.d.ts: Excerpt from that file: ```TypeScript interface Response extends Object, Body { readonly body: ReadableStream | null; readonly headers: Headers; readonly ok: boolean; readonly status: number; readonly statusText: string; readonly type: ResponseType; readonly url: string; readonly redirected: boolean; clone(): Response; } declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>; ``` If it's intended to wrap the common fetch function perfectly, it should directly reference the types from lib.dom.d.ts.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#194
No description provided.