From 2ceda6e7ea15eeaa8239832ecdbbb42ff87fbcf8 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 25 Jun 2019 12:39:47 -0700 Subject: [PATCH] Add WindowOrWorkerGlobalScope.fetch (#36453) This is compatible with TS3.6 and above. --- types/react-native/globals.d.ts | 4 ++++ types/react-native/test/globals.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/react-native/globals.d.ts b/types/react-native/globals.d.ts index 613fd663be..7f27293b5b 100644 --- a/types/react-native/globals.d.ts +++ b/types/react-native/globals.d.ts @@ -31,6 +31,10 @@ declare interface GlobalFetch { declare function fetch(input: RequestInfo, init?: RequestInit): Promise; +declare interface WindowOrWorkerGlobalScope { + fetch(input: RequestInfo, init?: RequestInit): Promise; +} + interface Blob {} declare class FormData { diff --git a/types/react-native/test/globals.tsx b/types/react-native/test/globals.tsx index c2e3a2dcab..a2fdf241a5 100644 --- a/types/react-native/test/globals.tsx +++ b/types/react-native/test/globals.tsx @@ -1,4 +1,4 @@ -const fetchCopy: GlobalFetch["fetch"] = fetch; +const fetchCopy: WindowOrWorkerGlobalScope["fetch"] = fetch; const myHeaders = new Headers(); myHeaders.append("Content-Type", "image/jpeg");