From 3defe24e7bb67bd0d4f6ce606b48e8d1b51d6fc5 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Thu, 27 Oct 2022 15:25:39 +0400 Subject: [PATCH] Move fetch to TS --- src/utils/{fetch.js => fetch.ts} | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename src/utils/{fetch.js => fetch.ts} (86%) diff --git a/src/utils/fetch.js b/src/utils/fetch.ts similarity index 86% rename from src/utils/fetch.js rename to src/utils/fetch.ts index f506b1d73..9205fe6c5 100644 --- a/src/utils/fetch.js +++ b/src/utils/fetch.ts @@ -1,3 +1,4 @@ +// @ts-ignore import Promise from 'promise-polyfill'; import { hasWin } from './mixins'; @@ -6,9 +7,10 @@ if (hasWin()) { } export default typeof fetch == 'function' - ? fetch.bind() - : (url, options) => { - return new Promise((res, rej) => { + ? // @ts-ignore + fetch.bind() + : (url: string, options: Record) => { + return new Promise((res: any, rej: any) => { const req = new XMLHttpRequest(); req.open(options.method || 'get', url); req.withCredentials = options.credentials == 'include';