Skip to content

Commit

Permalink
remove a few TS non-null assertion operators
Browse files Browse the repository at this point in the history
every time we use `!`, a juvenile cat suffers an untimely demise
  • Loading branch information
ornicar committed Apr 1, 2024
1 parent 9b3deea commit 380eabf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ui/analyse/src/study/relay/relayCtrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ export default class RelayCtrl {
this.leaderboard = data.tour.leaderboard ? new RelayLeaderboard(data.tour.id, redraw) : undefined;
setInterval(() => this.redraw(true), 1000);

const pinned = data.pinned;
if (data.videoUrls) videoPlayerOnWindowResize(this.redraw);
if (data.pinned && this.pinStreamer()) this.streams.push([data.pinned.userId, data.pinned.name]);
if (pinned && this.pinStreamer()) this.streams.push([pinned.userId, pinned.name]);

site.pubsub.on('socket.in.crowd', d => {
const s = (d.streams as [string, string][]) ?? [];
if (this.pinStreamer()) s.unshift([data.pinned!.userId, data.pinned!.name]);
if (pinned && this.pinStreamer()) s.unshift([pinned.userId, pinned.name]);
if (!s) return;
if (this.streams.length === s.length && this.streams.every(([id], i) => id === s[i][0])) return;
this.streams = s;
Expand Down

0 comments on commit 380eabf

Please sign in to comment.