From 95f6ffdb55a998c47f16933929722390f72a04ca Mon Sep 17 00:00:00 2001 From: jli02 Date: Mon, 1 Apr 2019 18:57:38 -0400 Subject: [PATCH] fix(node-fetch): update HeadersInit --- types/node-fetch/index.d.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index 8883dc1b9d..df9f6a9652 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for node-fetch 2.1 +// Type definitions for node-fetch 2.3 // Project: https://github.com/bitinn/node-fetch // Definitions by: Torsten Werner // Niklas Lindgren // Vinay Bedre // Antonio Román // Andrew Leedham +// Jason Li // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -37,7 +38,7 @@ export class Request extends Body { export interface RequestInit { // whatwg/fetch standard options body?: BodyInit; - headers?: HeaderInit | { [index: string]: string }; + headers?: HeadersInit; method?: string; redirect?: RequestRedirect; @@ -98,7 +99,7 @@ export type RequestCache = | "reload"; export class Headers implements Iterable<[string, string]> { - constructor(init?: Headers | { [k: string]: string }); + constructor(init?: HeadersInit); forEach(callback: (value: string, name: string) => void): void; append(name: string, value: string): void; delete(name: string): void; @@ -165,12 +166,12 @@ export type ResponseType = | "opaqueredirect"; export interface ResponseInit { - headers?: HeaderInit; + headers?: HeadersInit; status: number; statusText?: string; } -export type HeaderInit = Headers | string[]; +export type HeadersInit = Headers | string[][] | { [key: string]: string }; export type BodyInit = ArrayBuffer | ArrayBufferView | NodeJS.ReadableStream | string | URLSearchParams; export type RequestInfo = string | Request;