UNPKG

@tmlmobilidade/utils

Version:

This package provides a collection of common utility functions used across projects within the organization.

10 lines (9 loc) 463 B
import { z } from 'zod'; /** * Convert an object to match a Zod schema's shape. * @param source - The source object to convert * @param template - The Zod schema to validate against * @returns The converted object containing only the fields defined in the schema * @throws {Error} If a required field is missing from the source object */ export declare function convertObject<T extends z.ZodObject<z.ZodRawShape>>(source: unknown, template: T): z.infer<T>;