Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
make ts-strict happier
Browse files Browse the repository at this point in the history
  • Loading branch information
justjanne committed Jun 15, 2023
1 parent 3629265 commit ba34424
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export function reconcileNotificationSettings(
enabled: model.mentions.keywords,
});
}
newKeywords.delete(rule.pattern);
newKeywords.delete(rule.pattern!);
}
for (const keyword of newKeywords) {
changes.added.push({
Expand Down
8 changes: 4 additions & 4 deletions src/models/notificationsettings/toNotificationSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ function shouldNotify(rules: (IPushRule | null | undefined | false)[]): boolean
continue;
}
const actions = NotificationUtils.decodeActions(rule.actions);
if (actions.notify) {
if (actions !== null && actions.notify) {
return true;
}
}
return false;
}

function determineSound(rules: (IPushRule | null | undefined | false)[]): string | null {
function determineSound(rules: (IPushRule | null | undefined | false)[]): string | undefined {
for (const rule of rules) {
if (rule === null || rule === undefined || rule === false || !rule.enabled) {
continue;
}
const actions = NotificationUtils.decodeActions(rule.actions);
if (actions.notify && actions.sound !== undefined) {
if (actions !== null && actions.notify && actions.sound !== undefined) {
return actions.sound;
}
}
Expand Down Expand Up @@ -90,6 +90,6 @@ export function toNotificationSettings(
]),
keywords: shouldNotify(contentRules),
},
keywords: contentRules.map((it) => it.pattern),
keywords: contentRules.map((it) => it.pattern!),
};
}

0 comments on commit ba34424

Please sign in to comment.