Skip to content

Commit 6df0af5

Browse files
committed
Get rid of non-null assertion
1 parent fd6c6c8 commit 6df0af5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<link rel="icon" href="favicon.ico" />
2626
</head>
2727
<body>
28-
<div id="react-root"></div>
28+
<div id="root"></div>
2929
<script type="module" src="./src/index.tsx"></script>
3030
</body>
3131
</html>

src/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ import './global.css';
77

88
import Root from './Root.js';
99

10-
createRoot(document.getElementById('react-root') as HTMLDivElement).render(
10+
const root = document.getElementById('root');
11+
12+
if (!root) {
13+
throw new Error('Could not find root element');
14+
}
15+
16+
createRoot(root).render(
1117
<StrictMode>
1218
<TProvider defaultLocale={defaultLocale} languageFiles={languageFiles}>
1319
<Root />

0 commit comments

Comments
 (0)