@tmlmobilidade/utils
Version:
A collection of utility functions and helpers for the TML Mobilidade Go monorepo, providing common functionality for batching operations, caching, HTTP requests, object manipulation, permissions, and more.
10 lines (9 loc) • 463 B
TypeScript
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>;