Skip to content

Commit

Permalink
fix: browser API types
Browse files Browse the repository at this point in the history
  • Loading branch information
MikkCZ committed Oct 6, 2024
1 parent c448017 commit 0fec5b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/background/httpClients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ async function verifyPontoonRequestToken(
): Promise<boolean> {
if (token) {
const storageKey = tokenStorageKey(token);
const tokenInfoValue: string | undefined = (
await browser.storage.session.get(storageKey)
const tokenInfoValue = (
(await browser.storage.session.get(storageKey)) as Record<string, string>
)[storageKey];
if (typeof tokenInfoValue === 'string') {
const tokenInfo: TokenInfo = JSON.parse(tokenInfoValue);
Expand Down
4 changes: 2 additions & 2 deletions src/commons/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export async function getOptions<ID extends OptionId>(
optionIds: ID[],
): Promise<OptionValues<ID>> {
const defaultValues = defaultOptionsFor(browserFamily());
const storageItems = await browser.storage.local.get(
const storageItems = (await browser.storage.local.get(
optionIds.map((optionId) => storageKeyFor(optionId)),
);
)) as Record<string, OptionValue<ID>>;
const optionsWithDefaultValues: Partial<OptionValues<ID>> = {};
for (const optionId of optionIds) {
const storageKey = storageKeyFor(optionId);
Expand Down
3 changes: 3 additions & 0 deletions src/commons/webExtensionsApi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ export function listenToMessages<
// no return to allow all listeners to react on the message
action(typedMessade, sender);
}
// always check check other actions if they are subscribed for this message
return undefined;
});
}

Expand All @@ -332,6 +334,7 @@ export function listenToMessagesAndRespond<
// only one listener can send a response
return action(typedMessade, sender);
} else {
// let other actions check if they are subscribed for this message
return undefined;
}
});
Expand Down

0 comments on commit 0fec5b1

Please sign in to comment.