UNPKG

@tmlmobilidade/types

Version:

This package provides shared Zod validation schemas and their corresponding TypeScript types for use across projects. All types are automatically inferred from the schemas to ensure full type safety and reduce maintenance overhead.

18 lines (17 loc) 788 B
import { z } from 'zod'; /** * UnixTimestamp, in this context, is a number that represents * the number of milliseconds since the Unix epoch (1970-01-01T00:00:00Z). */ export type UnixTimestamp = number & { __brand: 'UnixTimestamp'; }; export declare const unixTimeStampSchema: z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">; /** * This function validates if a number is a valid Unix Timestamp, in milliseconds. * It is assumed the number will always be greater than 10^10 (1e10) to ensure it is in milliseconds. * Throws an error if the date is invalid. * @param milliseconds - The number to be validated. * @returns The given number as a UnixTimestamp. */ export declare function validateUnixTimestamp(milliseconds: number): UnixTimestamp;