TanStackT
TanStack6mo ago
6 replies
wealthy-blue

Search params are automatically converted to number type.

I have a search param that is and id, for now the ids are numbers, eg 123, but they could also be uuids, which are just strings. If I type my id param as a z.string(), but pass 123 the validation fails, since it converts it to a number. How can I force it to accept it as a string? Using z.coerce changes the param to %22123%22 which I don't want.
Was this page helpful?