Skip to content

Commit

Permalink
bump @types/[email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
eritbh committed Oct 10, 2024
1 parent bf994e2 commit 31a1427
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
16 changes: 11 additions & 5 deletions extension/data/components/PageNotificationContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@ export function PageNotificationContainer () {

// Register listener for messages from the background page
useEffect(() => {
const messageListener = (message: any) => {
if (message.action === 'tb-show-page-notification') {
const messageListener = (message: unknown) => {
// TODO: we need proper types for these messages
if ((message as any).action === 'tb-show-page-notification') {
// Add to beginning of list so it shows up on top
// TODO: wouldn't it be better to do this via `flex-direction`?
setNotifications([message.details, ...notifications]);
} else if (message.action === 'tb-clear-page-notification') {
setNotifications([(message as any).details, ...notifications]);
} else if ((message as any).action === 'tb-clear-page-notification') {
// Remove the notification from the list
setNotifications(notifications.filter(notif => notif.id !== message.id));
setNotifications(notifications.filter(notif => notif.id !== (message as any).id));
}

// `@types/webextension-polyfill` wants us to explicitly return
// `undefined` from synchronous listeners to indicate that we're not
// doing any async stuff relying on the `sendResponse` param
return undefined;
};

browser.runtime.onMessage.addListener(messageListener);
Expand Down
3 changes: 2 additions & 1 deletion extension/data/tbapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export const sendRequest = async ({
okOnly,
}: RequestOptions) => {
// Make the request
const messageReply = await browser.runtime.sendMessage({
// TODO: types for runtime messages
const messageReply: any = await browser.runtime.sendMessage({
action: 'tb-request',
method,
endpoint,
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@types/jquery.timeago": "^1.0.33",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@types/webextension-polyfill": "^0.10.7",
"@types/webextension-polyfill": "^0.12.1",
"cross-env": "^7.0.3",
"del-cli": "^6.0.0",
"docdash": "^2.0.2",
Expand Down

0 comments on commit 31a1427

Please sign in to comment.