Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added fetch api type definitions extracted from official dom lib using ts-graft #93

Merged
merged 1 commit into from Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 22 additions & 9 deletions index.d.ts
@@ -1,14 +1,27 @@
/// <reference lib="dom" />
import {
Headers,
Request,
RequestInfo,
RequestInit,
Response,
} from "./lib.fetch"

declare const _fetch: typeof fetch;
declare const _Request: typeof Request;
declare const _Response: typeof Response;
declare const _Headers: typeof Headers;

declare module "cross-fetch" {
export const fetch: typeof _fetch;
export const Request: typeof _Request;
export const Response: typeof _Response;
export const Headers: typeof _Headers;
export const fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
export const Request: {
prototype: Request;
new(input: RequestInfo, init?: RequestInit): Request;
};
export const Response: {
prototype: Response;
new(body?: BodyInit | null, init?: ResponseInit): Response;
error(): Response;
redirect(url: string, status?: number): Response;
};
export const Headers: {
prototype: Headers;
new(init?: HeadersInit): Headers;
};
export default fetch;
}