From 2f59448486e8735f868c563267ec604652187992 Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Wed, 17 Apr 2024 12:06:44 +0200 Subject: [PATCH] Get rid of non-null assertion --- test/index.html | 2 +- test/index.tsx | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/index.html b/test/index.html index 9a99e02..6e6246f 100644 --- a/test/index.html +++ b/test/index.html @@ -6,7 +6,7 @@ react-async-button test page -
+
diff --git a/test/index.tsx b/test/index.tsx index caf8bfe..fabd14f 100644 --- a/test/index.tsx +++ b/test/index.tsx @@ -3,7 +3,13 @@ import { createRoot } from 'react-dom/client'; import Test from './Test.js'; -createRoot(document.getElementById('react-root')!).render( +const root = document.getElementById('root'); + +if (!root) { + throw new Error('Could not find root element'); +} + +createRoot(root).render( , -- 2.54.0