@ts-rest/core
Version:
RPC-like experience over a regular REST API, with type safe server implementations 🪄
136 lines (135 loc) • 5.97 kB
TypeScript
import { z } from 'zod';
export declare const isZodType: (obj: unknown) => obj is z.ZodTypeAny;
export declare const isZodObject: (obj: unknown) => obj is z.AnyZodObject | z.ZodEffects<z.AnyZodObject, {
[x: string]: any;
}, {
[x: string]: any;
}>;
export declare const isZodObjectStrict: (obj: unknown) => obj is z.AnyZodObject;
export declare const extractZodObjectShape: <T extends z.AnyZodObject | z.ZodEffects<z.ZodTypeAny, any, any>>(obj: T) => any;
export declare const zodMerge: (objectA: unknown, objectB: unknown) => {};
export declare const checkZodSchema: (data: unknown, schema: unknown, { passThroughExtraKeys }?: {
passThroughExtraKeys?: boolean | undefined;
}) => {
success: true;
data: unknown;
} | {
success: false;
error: z.ZodError;
};
export declare const zodErrorResponse: (error: z.ZodError) => Pick<z.ZodError, 'name' | 'issues'>;
export declare const ZodErrorSchema: z.ZodObject<{
name: z.ZodLiteral<"ZodError">;
issues: z.ZodArray<z.ZodObject<{
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
message: z.ZodOptional<z.ZodString>;
code: z.ZodNativeEnum<{
invalid_type: "invalid_type";
invalid_literal: "invalid_literal";
custom: "custom";
invalid_union: "invalid_union";
invalid_union_discriminator: "invalid_union_discriminator";
invalid_enum_value: "invalid_enum_value";
unrecognized_keys: "unrecognized_keys";
invalid_arguments: "invalid_arguments";
invalid_return_type: "invalid_return_type";
invalid_date: "invalid_date";
invalid_string: "invalid_string";
too_small: "too_small";
too_big: "too_big";
invalid_intersection_types: "invalid_intersection_types";
not_multiple_of: "not_multiple_of";
not_finite: "not_finite";
}>;
}, "strip", z.ZodAny, z.objectOutputType<{
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
message: z.ZodOptional<z.ZodString>;
code: z.ZodNativeEnum<{
invalid_type: "invalid_type";
invalid_literal: "invalid_literal";
custom: "custom";
invalid_union: "invalid_union";
invalid_union_discriminator: "invalid_union_discriminator";
invalid_enum_value: "invalid_enum_value";
unrecognized_keys: "unrecognized_keys";
invalid_arguments: "invalid_arguments";
invalid_return_type: "invalid_return_type";
invalid_date: "invalid_date";
invalid_string: "invalid_string";
too_small: "too_small";
too_big: "too_big";
invalid_intersection_types: "invalid_intersection_types";
not_multiple_of: "not_multiple_of";
not_finite: "not_finite";
}>;
}, z.ZodAny, "strip">, z.objectInputType<{
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
message: z.ZodOptional<z.ZodString>;
code: z.ZodNativeEnum<{
invalid_type: "invalid_type";
invalid_literal: "invalid_literal";
custom: "custom";
invalid_union: "invalid_union";
invalid_union_discriminator: "invalid_union_discriminator";
invalid_enum_value: "invalid_enum_value";
unrecognized_keys: "unrecognized_keys";
invalid_arguments: "invalid_arguments";
invalid_return_type: "invalid_return_type";
invalid_date: "invalid_date";
invalid_string: "invalid_string";
too_small: "too_small";
too_big: "too_big";
invalid_intersection_types: "invalid_intersection_types";
not_multiple_of: "not_multiple_of";
not_finite: "not_finite";
}>;
}, z.ZodAny, "strip">>, "many">;
}, "strip", z.ZodTypeAny, {
name: "ZodError";
issues: z.objectOutputType<{
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
message: z.ZodOptional<z.ZodString>;
code: z.ZodNativeEnum<{
invalid_type: "invalid_type";
invalid_literal: "invalid_literal";
custom: "custom";
invalid_union: "invalid_union";
invalid_union_discriminator: "invalid_union_discriminator";
invalid_enum_value: "invalid_enum_value";
unrecognized_keys: "unrecognized_keys";
invalid_arguments: "invalid_arguments";
invalid_return_type: "invalid_return_type";
invalid_date: "invalid_date";
invalid_string: "invalid_string";
too_small: "too_small";
too_big: "too_big";
invalid_intersection_types: "invalid_intersection_types";
not_multiple_of: "not_multiple_of";
not_finite: "not_finite";
}>;
}, z.ZodAny, "strip">[];
}, {
name: "ZodError";
issues: z.objectInputType<{
path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
message: z.ZodOptional<z.ZodString>;
code: z.ZodNativeEnum<{
invalid_type: "invalid_type";
invalid_literal: "invalid_literal";
custom: "custom";
invalid_union: "invalid_union";
invalid_union_discriminator: "invalid_union_discriminator";
invalid_enum_value: "invalid_enum_value";
unrecognized_keys: "unrecognized_keys";
invalid_arguments: "invalid_arguments";
invalid_return_type: "invalid_return_type";
invalid_date: "invalid_date";
invalid_string: "invalid_string";
too_small: "too_small";
too_big: "too_big";
invalid_intersection_types: "invalid_intersection_types";
not_multiple_of: "not_multiple_of";
not_finite: "not_finite";
}>;
}, z.ZodAny, "strip">[];
}>;