Skip to content

Commit 16134c1

Browse files
committed
Merge pull request DefinitelyTyped#6839 from arusakov/whatwg-fetch-global-variable
Whatwg fetch global fetch variable
2 parents 8c985f4 + c865ee8 commit 16134c1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

whatwg-fetch/whatwg-fetch-tests.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ function test_fetchUrlWithRequestObject() {
3939
handlePromise(window.fetch(request));
4040
}
4141

42+
function test_globalFetchVar() {
43+
fetch('http://test.com', {})
44+
.then(response => {
45+
// for test only
46+
});
47+
}
48+
4249
function handlePromise(promise: Promise<Response>) {
4350
promise.then((response) => {
4451
if (response.type === 'basic') {

whatwg-fetch/whatwg-fetch.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,5 @@ declare type RequestInfo = Request|string;
8383
interface Window {
8484
fetch(url: string|Request, init?: RequestInit): Promise<Response>;
8585
}
86+
87+
declare var fetch: typeof window.fetch;

0 commit comments

Comments
 (0)