Skip to content

Commit

Permalink
Use non-null assertion instead of type assertion in createRoot()
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Aug 23, 2023
1 parent d14e13f commit c431d25
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sample/create-react-app-5/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import { createRoot } from 'react-dom/client';

import Sample from './Sample.js';

createRoot(document.getElementById('react-root') as HTMLDivElement).render(<Sample />);
createRoot(document.getElementById('react-root')!).render(<Sample />);
2 changes: 1 addition & 1 deletion sample/parcel2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import { createRoot } from 'react-dom/client';

import Sample from './Sample.js';

createRoot(document.getElementById('react-root') as HTMLDivElement).render(<Sample />);
createRoot(document.getElementById('react-root')!).render(<Sample />);
2 changes: 1 addition & 1 deletion sample/vite3/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import { createRoot } from 'react-dom/client';

import Sample from './Sample.js';

createRoot(document.getElementById('react-root') as HTMLDivElement).render(<Sample />);
createRoot(document.getElementById('react-root')!).render(<Sample />);
2 changes: 1 addition & 1 deletion sample/vite4/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import { createRoot } from 'react-dom/client';

import Sample from './Sample.js';

createRoot(document.getElementById('react-root') as HTMLDivElement).render(<Sample />);
createRoot(document.getElementById('react-root')!).render(<Sample />);
2 changes: 1 addition & 1 deletion sample/webpack5/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import { createRoot } from 'react-dom/client';

import Sample from './Sample.js';

createRoot(document.getElementById('react-root') as HTMLDivElement).render(<Sample />);
createRoot(document.getElementById('react-root')!).render(<Sample />);
2 changes: 1 addition & 1 deletion test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createRoot } from 'react-dom/client';

import Test from './Test.js';

createRoot(document.getElementById('react-root') as HTMLDivElement).render(
createRoot(document.getElementById('react-root')!).render(
<StrictMode>
<Test />
</StrictMode>,
Expand Down

0 comments on commit c431d25

Please sign in to comment.