diff options
-rw-r--r-- | .eslintrc | 1 | ||||
-rw-r--r-- | src/background/presenters/TabPresenter.ts | 24 | ||||
-rw-r--r-- | src/background/repositories/BrowserSettingRepository.ts | 2 | ||||
-rw-r--r-- | test/background/completion/TabCompletionUseCase.test.ts | 2 | ||||
-rw-r--r-- | test/background/usecases/NavigateUseCase.test.ts | 2 |
5 files changed, 25 insertions, 6 deletions
@@ -24,7 +24,6 @@ } }, "rules": { - "@typescript-eslint/ban-types": "off", "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/no-empty-function": "off", diff --git a/src/background/presenters/TabPresenter.ts b/src/background/presenters/TabPresenter.ts index 09cfa23..2f8f5d9 100644 --- a/src/background/presenters/TabPresenter.ts +++ b/src/background/presenters/TabPresenter.ts @@ -8,7 +8,17 @@ type Tab = browser.tabs.Tab; export default interface TabPresenter { open(url: string, tabId?: number): Promise<Tab>; - create(url: string, opts?: object): Promise<Tab>; + create( + url: string, + opts?: { + active?: boolean; + cookieStoreId?: string; + index?: number; + openerTabId?: number; + pinned?: boolean; + windowId?: number; + } + ): Promise<Tab>; getCurrent(): Promise<Tab>; @@ -44,7 +54,17 @@ export class TabPresenterImpl implements TabPresenter { return browser.tabs.update(tabId, { url }); } - create(url: string, opts?: object): Promise<Tab> { + create( + url: string, + opts?: { + active?: boolean; + cookieStoreId?: string; + index?: number; + openerTabId?: number; + pinned?: boolean; + windowId?: number; + } + ): Promise<Tab> { return browser.tabs.create({ url, ...opts }); } diff --git a/src/background/repositories/BrowserSettingRepository.ts b/src/background/repositories/BrowserSettingRepository.ts index 20013f4..272cc1e 100644 --- a/src/background/repositories/BrowserSettingRepository.ts +++ b/src/background/repositories/BrowserSettingRepository.ts @@ -13,7 +13,7 @@ declare namespace browser.browserSettings.homepageOverride { | "controllable_by_this_extension" | "controlled_by_this_extension"; - function get(param: object): Promise<BrowserSettings>; + function get(param: { [key: string]: string }): Promise<BrowserSettings>; } @injectable() diff --git a/test/background/completion/TabCompletionUseCase.test.ts b/test/background/completion/TabCompletionUseCase.test.ts index d8aa385..e1a88a2 100644 --- a/test/background/completion/TabCompletionUseCase.test.ts +++ b/test/background/completion/TabCompletionUseCase.test.ts @@ -18,7 +18,7 @@ class MockTabRepository implements TabRepositoryImpl { } class MockTabPresenter implements TabPresenter { - create(_url: string, _opts?: object): Promise<browser.tabs.Tab> { + create(_url: string, _opts?: unknown): Promise<browser.tabs.Tab> { throw new Error("not implemented"); } diff --git a/test/background/usecases/NavigateUseCase.test.ts b/test/background/usecases/NavigateUseCase.test.ts index 7263627..086d6cd 100644 --- a/test/background/usecases/NavigateUseCase.test.ts +++ b/test/background/usecases/NavigateUseCase.test.ts @@ -5,7 +5,7 @@ import NavigateClient from "../../../src/background/clients/NavigateClient"; import * as sinon from "sinon"; class MockTabPresenter implements TabPresenter { - create(_url: string, _opts?: object): Promise<browser.tabs.Tab> { + create(_url: string, _opts?: unknown): Promise<browser.tabs.Tab> { throw new Error("not implemented"); } |