From 3555e9a7bfe97915578c5bd18f7cb7069b2542b7 Mon Sep 17 00:00:00 2001
From: Paul <paulmakles@gmail.com>
Date: Mon, 21 Jun 2021 09:02:38 +0100
Subject: [PATCH] Use null assertions instead of casting.

---
 .../common/messaging/attachments/AttachmentActions.tsx        | 2 +-
 src/components/common/messaging/attachments/TextFile.tsx      | 2 +-
 src/components/common/messaging/embed/EmbedMedia.tsx          | 2 +-
 src/pages/channels/messaging/MessageRenderer.tsx              | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/components/common/messaging/attachments/AttachmentActions.tsx b/src/components/common/messaging/attachments/AttachmentActions.tsx
index 054fc98..f33eebf 100644
--- a/src/components/common/messaging/attachments/AttachmentActions.tsx
+++ b/src/components/common/messaging/attachments/AttachmentActions.tsx
@@ -23,7 +23,7 @@ export default function AttachmentActions({ attachment }: Props) {
     const client = useContext(AppContext);
     const { filename, metadata, size } = attachment;
 
-    const url = client.generateFileURL(attachment) as string;
+    const url = client.generateFileURL(attachment)!;
     const open_url = `${url}/${filename}`;
     const download_url = url.replace('attachments', 'attachments/download')
 
diff --git a/src/components/common/messaging/attachments/TextFile.tsx b/src/components/common/messaging/attachments/TextFile.tsx
index 4dd8d43..810a2f0 100644
--- a/src/components/common/messaging/attachments/TextFile.tsx
+++ b/src/components/common/messaging/attachments/TextFile.tsx
@@ -18,7 +18,7 @@ export default function TextFile({ attachment }: Props) {
     const status = useContext(StatusContext);
     const client = useContext(AppContext);
 
-    const url = client.generateFileURL(attachment);
+    const url = client.generateFileURL(attachment)!;
 
     useEffect(() => {
         if (typeof content !== 'undefined') return;
diff --git a/src/components/common/messaging/embed/EmbedMedia.tsx b/src/components/common/messaging/embed/EmbedMedia.tsx
index 7323f03..70c0457 100644
--- a/src/components/common/messaging/embed/EmbedMedia.tsx
+++ b/src/components/common/messaging/embed/EmbedMedia.tsx
@@ -43,7 +43,7 @@ export default function EmbedMedia({ embed, width, height }: Props) {
         )
         case 'Soundcloud': return (
             <iframe
-                src={`https://w.soundcloud.com/player/?url=${encodeURIComponent(embed.url as string)}&color=%23FF7F50&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true`}
+                src={`https://w.soundcloud.com/player/?url=${encodeURIComponent(embed.url!)}&color=%23FF7F50&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true`}
                 frameBorder="0"
                 scrolling="no"
                 style={{ height }} />
diff --git a/src/pages/channels/messaging/MessageRenderer.tsx b/src/pages/channels/messaging/MessageRenderer.tsx
index 205ecb3..9e690e7 100644
--- a/src/pages/channels/messaging/MessageRenderer.tsx
+++ b/src/pages/channels/messaging/MessageRenderer.tsx
@@ -132,14 +132,14 @@ function MessageRenderer({ id, state, queue }: Props) {
             if (previous) {
                 compare(
                     msg.id,
-                    userId as string,
+                    userId!,
                     previous._id,
                     previous.author
                 );
                 
                 previous = {
                     _id: msg.id,
-                    data: { author: userId as string }
+                    data: { author: userId! }
                 } as any;
             }
 
-- 
GitLab