Como usar o TypeScript no CreaterOot

// 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)

// typescript error on createRoot (React 18)

// const root = ReactDOM.createRoot(document.getElementById("root"))


--- add non-null assertion

const root = ReactDOM.createRoot(document.getElementById("root")!)


Runtime Terror