_envelope.ts 271 B

12345678910
  1. import { z } from 'zod';
  2. export const msgSchema = <T extends z.ZodType>(obj: T) =>
  3. z.object({
  4. success: z.boolean(),
  5. msg: z.string().default(''),
  6. obj: obj.nullable(),
  7. });
  8. export type MsgOf<S extends z.ZodType> = z.infer<ReturnType<typeof msgSchema<S>>>;