From d8bfb5a029be9252d46a2ccaf316a9958c6393ec Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Fri, 8 Oct 2021 15:25:36 +0200 Subject: [PATCH] Added parameter and return types for tabsQueries in BrowserApi --- src/browser/browserApi.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/browser/browserApi.ts b/src/browser/browserApi.ts index c52325b20cd..7e592a16dbd 100644 --- a/src/browser/browserApi.ts +++ b/src/browser/browserApi.ts @@ -11,27 +11,27 @@ export class BrowserApi { static isFirefoxOnAndroid: boolean = navigator.userAgent.indexOf('Firefox/') !== -1 && navigator.userAgent.indexOf('Android') !== -1; - static async getTabFromCurrentWindowId(): Promise { + static async getTabFromCurrentWindowId(): Promise | null { return await BrowserApi.tabsQueryFirst({ active: true, windowId: chrome.windows.WINDOW_ID_CURRENT, }); } - static async getTabFromCurrentWindow(): Promise { + static async getTabFromCurrentWindow(): Promise | null { return await BrowserApi.tabsQueryFirst({ active: true, currentWindow: true, }); } - static async getActiveTabs(): Promise { + static async getActiveTabs(): Promise { return await BrowserApi.tabsQuery({ active: true, }); } - static async tabsQuery(options: any): Promise { + static async tabsQuery(options: chrome.tabs.QueryInfo): Promise { return new Promise(resolve => { chrome.tabs.query(options, (tabs: any[]) => { resolve(tabs); @@ -39,7 +39,7 @@ export class BrowserApi { }); } - static async tabsQueryFirst(options: any): Promise { + static async tabsQueryFirst(options: chrome.tabs.QueryInfo): Promise | null { const tabs = await BrowserApi.tabsQuery(options); if (tabs.length > 0) { return tabs[0];