Skip to content

Commit

Permalink
Get rid of non-null assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Apr 17, 2024
1 parent 50fa88c commit f64bdd1
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 10 deletions.
2 changes: 1 addition & 1 deletion sample/create-react-app-5/public/index.html
Expand Up @@ -6,6 +6,6 @@
<title>react-pdf sample page</title>
</head>
<body>
<div id="react-root"></div>
<div id="root"></div>
</body>
</html>
8 changes: 7 additions & 1 deletion sample/create-react-app-5/src/index.tsx
Expand Up @@ -2,4 +2,10 @@ import { createRoot } from 'react-dom/client';

import Sample from './Sample';

createRoot(document.getElementById('react-root')!).render(<Sample />);
const root = document.getElementById('root');

if (!root) {
throw new Error('Could not find root element');
}

createRoot(root).render(<Sample />);
2 changes: 1 addition & 1 deletion sample/parcel2/index.html
Expand Up @@ -6,7 +6,7 @@
<title>react-pdf sample page</title>
</head>
<body>
<div id="react-root"></div>
<div id="root"></div>
<script type="module" src="./index.tsx"></script>
</body>
</html>
8 changes: 7 additions & 1 deletion sample/parcel2/index.tsx
Expand Up @@ -2,4 +2,10 @@ import { createRoot } from 'react-dom/client';

import Sample from './Sample';

createRoot(document.getElementById('react-root')!).render(<Sample />);
const root = document.getElementById('root');

if (!root) {
throw new Error('Could not find root element');
}

createRoot(root).render(<Sample />);
2 changes: 1 addition & 1 deletion sample/vite/index.html
Expand Up @@ -6,7 +6,7 @@
<title>react-pdf sample page</title>
</head>
<body>
<div id="react-root"></div>
<div id="root"></div>
<script type="module" src="./index.tsx"></script>
</body>
</html>
8 changes: 7 additions & 1 deletion sample/vite/index.tsx
Expand Up @@ -2,4 +2,10 @@ import { createRoot } from 'react-dom/client';

import Sample from './Sample.js';

createRoot(document.getElementById('react-root')!).render(<Sample />);
const root = document.getElementById('root');

if (!root) {
throw new Error('Could not find root element');
}

createRoot(root).render(<Sample />);
2 changes: 1 addition & 1 deletion sample/webpack5/index.html
Expand Up @@ -6,6 +6,6 @@
<title>react-pdf sample page</title>
</head>
<body>
<div id="react-root"></div>
<div id="root"></div>
</body>
</html>
8 changes: 7 additions & 1 deletion sample/webpack5/index.tsx
Expand Up @@ -2,4 +2,10 @@ import { createRoot } from 'react-dom/client';

import Sample from './Sample';

createRoot(document.getElementById('react-root')!).render(<Sample />);
const root = document.getElementById('root');

if (!root) {
throw new Error('Could not find root element');
}

createRoot(root).render(<Sample />);
2 changes: 1 addition & 1 deletion test/index.html
Expand Up @@ -6,7 +6,7 @@
<title>react-pdf test page</title>
</head>
<body>
<div id="react-root"></div>
<div id="root"></div>
<script type="module" src="./index.tsx"></script>
</body>
</html>
8 changes: 7 additions & 1 deletion test/index.tsx
Expand Up @@ -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(
<StrictMode>
<Test />
</StrictMode>,
Expand Down

0 comments on commit f64bdd1

Please sign in to comment.