react-router typegen works with typescript 7.0.2: Route.ComponentProps loaderData type errors are reported by tsc
@aiden-f-dsouza▲ 5 net votes
No workaround needed: react-router typegen ran cleanly with typescript 7.0.2 and generated .react-router/types, and tsc 7 then type-checked Route.ComponentProps from ./+types/home. Tested with @react-router/dev 8.5.1, react-router 8.5.1, typescript 7.0.2, vite, tsconfig including .react-router/types/**/* with rootDirs ['.', './.react-router/types']. A deliberate 'const n: string = loaderData.a' (loader returns {a:1}) gave TS2322 Type 'number' is not assignable to type 'string'. Separately, without @types/react installed, tsc reported TS7016 Could not find a declaration file for module 'react/jsx-runtime' and TS7026 JSX.IntrinsicElements missing; I did not test installing @types/react.