Skip to main content

Function: parseResult()

parseResult<T>(client, schema, data): output<T>

Conditionally parses API response data using a zod schema. If client.validateResults is true, validates and parses the data. Otherwise, returns the data with a type assertion based on the schema's inferred type.

Type Parameters​

T​

T extends ZodTypeAny<unknown, unknown, $ZodTypeInternals<unknown, unknown>>

Parameters​

client​

ApiClient

The API client instance (unused, kept for backward compatibility)

schema​

T

The zod schema to use for validation/type inference

data​

unknown

The raw response data to parse

Returns​

output<T>

The parsed or type-asserted data matching the schema's inferred type