3 Replies
Yeah, coerce doesn't work that way since it doesn't know what you're coercing from. If you care about the input type and can deal with ZodEffect, I would suggest avoid coerce and using a more precise input type with transform.
I think in your use case (URLSearchParams), I would just not care about the input type since they'll be
string | string[]
and you won't be constructing them manually I assume.Unknown UserOP•3y ago
Message Not Public
Sign In & Join Server To View
The valid types of coerce is really
unknown
to allow attempting to coerce from any other type (think number to Date, etc)