Skip to content

ExtractSchema

ExtractSchema<T> = T extends object ? S : EmptySchema

Defined in: packages/codecs/src/schema-types.ts:116

Extract the schema type from a Module or Client instance.

T

parent.ts
const worker = new Module("worker")
.method("search", {
requestCodec: msgpack<SearchQuery>(),
responseCodec: msgpack<SearchResult>(),
});
export type WorkerSchema = ExtractSchema<typeof worker>;
// child.ts
import type { WorkerSchema } from "./parent.js";
const client = new Client<WorkerSchema>();