import { z } from 'zod'; import { ZodBase } from './def'; /** * Type utility to extract the return type from an API definition. * If the API has a voSchema (Value Object schema), returns the output type of that schema, otherwise void. * This enables automatic type inference for API responses in both client and server code. * * @template T - The API definition type * @example * ```typescript * const api = defineAPI({ * path: '/users', * voSchema: z.object({ id: z.string(), name: z.string() }) * }) * type UserResponse = ReturnType // { id: string, name: string } * ``` */ export type ReturnType = T extends { voSchema: ZodBase; } ? z.output : void; /** * Type utility to extract the argument type from an API definition. * If the API has a dtoSchema (Data Transfer Object schema), returns the output type of that schema, otherwise void. * This enables automatic type inference for API request parameters in both client and server code. * * @template T - The API definition type * @example * ```typescript * const api = defineAPI({ * path: '/users', * dtoSchema: z.object({ name: z.string(), email: z.string() }) * }) * type UserRequest = ArgType // { name: string, email: string } * ``` */ export type ArgType = T extends { dtoSchema: ZodBase; } ? z.output : void; //# sourceMappingURL=types.d.ts.map