typescript: Convert some && constructions to optional chains.

Some upcoming changes to how types are constructed are going
to bring up these type linter errors, so fix them now.
This commit is contained in:
evykassirer 2024-10-10 11:28:36 -07:00 committed by Tim Abbott
parent e5dd75baf0
commit 808c24aef2
2 changed files with 3 additions and 3 deletions

View File

@ -428,8 +428,8 @@ export class MessageList {
let deactivated = false;
let just_unsubscribed = false;
const subscribed = stream_data.is_subscribed(stream_id);
const invite_only = sub && sub.invite_only;
const is_web_public = sub && sub.is_web_public;
const invite_only = sub?.invite_only;
const is_web_public = sub?.is_web_public;
const can_toggle_subscription =
sub !== undefined && stream_data.can_toggle_subscription(sub);
if (sub === undefined) {

View File

@ -323,7 +323,7 @@ function render_user_stream_list(streams: StreamSubscription[], user: User): voi
filter: {
$element: $("#user-profile-streams-tab .stream-search"),
predicate(item, value) {
return item && item.name.toLocaleLowerCase().includes(value);
return item?.name.toLocaleLowerCase().includes(value);
},
onupdate() {
if ($container.find(".empty-table-message").length) {