createQueryDecoder
createQueryDecoder<
T>(validate?): (input) =>ValidationResult<T>
Defined in: wp-typia-rest/src/http.ts:84
Decode query-string shaped input into a validated object.
Type Parameters
Section titled “Type Parameters”T extends object
Parameters
Section titled “Parameters”validate?
Section titled “validate?”(input) => IFailure | { data?: unknown; errors?: unknown; success?: unknown; } | ISuccess<T>
Optional validator for the normalized query input.
Returns
Section titled “Returns”A decoder that accepts query strings, URLSearchParams, or objects.
(input) => ValidationResult<T>
Example
Section titled “Example”const decodeQuery = createQueryDecoder(validateQuery);const query = decodeQuery("page=2&search=hero");