TanStackT
TanStack15mo ago
5 replies
dangerous-fuchsia

validate search params using Valibot Error

Hello, I have followed the documentation here (https://tanstack.com/router/latest/docs/framework/react/guide/search-params#valibot) for validating search params using valibot. However I got some error saying that the type doesn't match. Does anyone know how to solve this? Thanks in advance!

Here's my code:
const AuthErrorSearchSchema = object({
  message: optional(
    fallback(string(), "An error occurred"),
    "An error occurred"
  ),
});

export const Route = createFileRoute("/auth-error")({
  validateSearch: AuthErrorSearchSchema,
});
image.png
image.png
Headless, type-safe, powerful utilities for complex workflows like Data Management, Data Visualization, Charts, Tables, and UI Components.
TanStack | High Quality Open-Source Software for Web Developers
Preview image
Was this page helpful?