fix(react-router): accept valid ReactNode as route component
In route.ts, there's a custom alias for ReactNode set to any. Based on the commit history alone, it looks like it was introduced for backward compatibility with typescript <5.1. This PR conditionally uses the real type from react if typescript >5.0 is available.
Using any allowed to pass any function as a route component, even when it wasn't a valid react component, causing a runtime crash.
☁️ Nx Cloud Report
CI is running/has finished running commands for commit 671ce5ed97d6e5b1ac66c550b9d94870c355c65f. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 2 targets
Sent with 💌 from NxCloud.
More templates
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-file-based-codesplitting
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- tanstack-router-react-example-scroll-restoration
- tanstack-router-search-validator-adapters
- tanstack-router-example-react-start-basic
- tanstack-router-example-react-start-basic-auth
- tanstack-router-example-react-start-basic-counter
- tanstack-router-example-react-start-basic-react-query
- tanstack-router-example-react-start-basic-rsc
- tanstack-router-example-react-start-clerk-basic
- tanstack-router-example-react-start-trello-trellaux
- tanstack-router-example-react-start-trellaux
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
@tanstack/history
pnpm add https://pkg.pr.new/@tanstack/history@2194
@tanstack/react-cross-context
pnpm add https://pkg.pr.new/@tanstack/react-cross-context@2194
@tanstack/react-router-with-query
pnpm add https://pkg.pr.new/@tanstack/react-router-with-query@2194
@tanstack/router-arktype-adapter
pnpm add https://pkg.pr.new/@tanstack/router-arktype-adapter@2194
@tanstack/router-cli
pnpm add https://pkg.pr.new/@tanstack/router-cli@2194
@tanstack/router-devtools
pnpm add https://pkg.pr.new/@tanstack/router-devtools@2194
@tanstack/router-plugin
pnpm add https://pkg.pr.new/@tanstack/router-plugin@2194
@tanstack/router-generator
pnpm add https://pkg.pr.new/@tanstack/router-generator@2194
@tanstack/react-router
pnpm add https://pkg.pr.new/@tanstack/react-router@2194
@tanstack/router-valibot-adapter
pnpm add https://pkg.pr.new/@tanstack/router-valibot-adapter@2194
@tanstack/router-vite-plugin
pnpm add https://pkg.pr.new/@tanstack/router-vite-plugin@2194
@tanstack/router-zod-adapter
pnpm add https://pkg.pr.new/@tanstack/router-zod-adapter@2194
@tanstack/start
pnpm add https://pkg.pr.new/@tanstack/start@2194
@tanstack/start-vite-plugin
pnpm add https://pkg.pr.new/@tanstack/start-vite-plugin@2194
commit: 671ce5e
@SeanCassiere Would you have a look? 🙏
Closing this PR, as the minimum typescript version has been moved up to 5.2 as listed on the website.
@honzahruby thank you for contributing towards this! we do very much appreciate it!