From 3555e9a7bfe97915578c5bd18f7cb7069b2542b7 Mon Sep 17 00:00:00 2001 From: Paul 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 054fc986..f33eebfa 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 4dd8d432..810a2f0b 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 7323f03d..70c04579 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 (