mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
fetch global variable
This commit is contained in:
parent
fc341765eb
commit
c865ee8d59
@ -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<Response>) {
|
||||
promise.then((response) => {
|
||||
if (response.type === 'basic') {
|
||||
|
||||
2
whatwg-fetch/whatwg-fetch.d.ts
vendored
2
whatwg-fetch/whatwg-fetch.d.ts
vendored
@ -83,3 +83,5 @@ declare type RequestInfo = Request|string;
|
||||
interface Window {
|
||||
fetch(url: string|Request, init?: RequestInit): Promise<Response>;
|
||||
}
|
||||
|
||||
declare var fetch: typeof window.fetch;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user