import { NestedClient, Client, ORPCError } from '@orpc/client'; type JsonifiedValue = T extends string ? T : T extends number ? T : T extends boolean ? T : T extends null ? T : T extends undefined ? T : T extends Array ? JsonifiedArray : T extends Record ? { [K in keyof T]: JsonifiedValue; } : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends RegExp ? string : T extends URL ? string : T extends Map ? JsonifiedArray<[K, V][]> : T extends Set ? JsonifiedArray : T extends AsyncIteratorObject ? AsyncIteratorObject, JsonifiedValue> : unknown; type JsonifiedArray> = T extends readonly [] ? [] : T extends readonly [infer U, ...infer V] ? [U extends undefined ? null : JsonifiedValue, ...JsonifiedArray] : T extends Array ? Array> : unknown; /** * Convert types that JSON not support to corresponding json types * * @see {@link https://orpc.dev/docs/openapi/client/openapi-link OpenAPI Link Docs} */ type JsonifiedClient> = T extends Client ? Client, UError extends ORPCError ? ORPCError> : UError> : { [K in keyof T]: T[K] extends NestedClient ? JsonifiedClient : T[K]; }; export type { JsonifiedArray, JsonifiedClient, JsonifiedValue };