diff --git a/whatwg-fetch/whatwg-fetch-tests.ts b/whatwg-fetch/whatwg-fetch-tests.ts index b6bae3066e..75fead12df 100644 --- a/whatwg-fetch/whatwg-fetch-tests.ts +++ b/whatwg-fetch/whatwg-fetch-tests.ts @@ -39,6 +39,13 @@ function test_fetchUrlWithRequestObject() { handlePromise(window.fetch(request)); } +function test_globalFetchVar() { + fetch('http://test.com', {}) + .then(response => { + // for test only + }); +} + function handlePromise(promise: Promise) { promise.then((response) => { if (response.type === 'basic') { diff --git a/whatwg-fetch/whatwg-fetch.d.ts b/whatwg-fetch/whatwg-fetch.d.ts index c6d95e87a0..a1d82c55f8 100644 --- a/whatwg-fetch/whatwg-fetch.d.ts +++ b/whatwg-fetch/whatwg-fetch.d.ts @@ -83,3 +83,5 @@ declare type RequestInfo = Request|string; interface Window { fetch(url: string|Request, init?: RequestInit): Promise; } + +declare var fetch: typeof window.fetch;