Argument of type 'HTMLElement | null' is not assignable to parameter of type 'Element | DocumentFragment'. Type 'null' is not assignable to type 'Element | DocumentFragment'.ts(2345)
改正后
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)