Skip to content

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.

T extends object

(input) => IFailure | { data?: unknown; errors?: unknown; success?: unknown; } | ISuccess<T>

Optional validator for the normalized query input.

A decoder that accepts query strings, URLSearchParams, or objects.

(input) => ValidationResult<T>

const decodeQuery = createQueryDecoder(validateQuery);
const query = decodeQuery("page=2&search=hero");