mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
expose isRedirect method of node-fetch in types
This commit is contained in:
Vendored
+8
-1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/bitinn/node-fetch
|
||||
// Definitions by: Torsten Werner <https://github.com/torstenwerner>
|
||||
// Niklas Lindgren <https://github.com/nikcorg>
|
||||
// Vinay Bedre <https://github.com/vinaybedre>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -168,7 +169,13 @@ export type HeaderInit = Headers | string[];
|
||||
export type BodyInit = ArrayBuffer | ArrayBufferView | NodeJS.ReadableStream | string | URLSearchParams;
|
||||
export type RequestInfo = string | Request;
|
||||
|
||||
export default function fetch(
|
||||
declare function fetch(
|
||||
url: string | Request,
|
||||
init?: RequestInit
|
||||
): Promise<Response>;
|
||||
|
||||
declare namespace fetch {
|
||||
function isRedirect(code: number): boolean;
|
||||
}
|
||||
|
||||
export default fetch;
|
||||
|
||||
@@ -77,3 +77,8 @@ function test_headersRaw() {
|
||||
const myHeader = 'foo';
|
||||
headers.raw()[myHeader]; // $ExpectType string[]
|
||||
}
|
||||
|
||||
function test_isRedirect() {
|
||||
fetch.isRedirect(301);
|
||||
fetch.isRedirect(201);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user