kkrpc
    Preparing search index...

    Type Alias InferAPI<T>

    InferAPI: {
        [K in keyof T]: T[K] extends DefinedMethod<infer I, infer O>
            ? (
                ...args: InferOutput<I> extends readonly any[]
                    ? InferOutput<I>
                    : [InferOutput<I>],
            ) => Promise<InferOutput<O>>
            : T[K] extends Record<string, unknown> ? InferAPI<T[K]> : T[K]
    }

    Infer the plain API type from a defineAPI() result.

    defineAPI() returns an object where methods are DefinedMethod instances (functions with ~validators metadata). The client side doesn't know about DefinedMethod — it just needs the plain function signatures. This type strips the metadata and produces a clean API type suitable for RPCChannel<{}, InferAPI<typeof api>>.

    • DefinedMethod → plain async function with inferred arg/return types
    • Nested Record<string, unknown> → recurse
    • Everything else → pass through unchanged

    Type Parameters

    • T