@4players/odin-common
Version:
Commonly used type definitions and utility functions across ODIN web projects
16 lines (15 loc) • 842 B
TypeScript
import { type infer as ZodInfer, type output as ZodOutput, type ZodType } from 'zod';
export type RpcValue = Uint8Array | string | number | boolean | null | RpcValue[] | {
[key: string]: RpcValue;
};
export type RpcSchema = ZodType<RpcValue, unknown>;
export type ByteArray = Uint8Array;
export declare const ByteArraySchema: ZodType<Uint8Array>;
export type JsonValue = string | number | boolean | null | {
[key: string]: JsonValue;
} | JsonValue[];
export declare const JsonSchema: ZodType<JsonValue>;
export type MessagePackRpc = [0, number, string, unknown] | [1, number, string | null, unknown] | [2, string, unknown];
export declare const MessagePackRpcSchema: ZodType<MessagePackRpc>;
export declare function oneOrMany<T extends ZodType>(type: T): ZodType<ZodInfer<T>[]>;
export type Infer<T extends RpcSchema> = ZodOutput<T>;