Something went wrong. Try again.
Something went wrong. Try again.
12345678910111213import { validate } from "@std/uuid/v7";import type { BRAND } from "zod";
export type UuidString = `${string}-${string}-7${string}-${string}-${string}`;export type Id<For extends string> = UuidString & BRAND<`${For}.id`>;
export function parseId<T extends Id<string>>(value: string): T { if (!validate(value)) { throw new Error(`Invalid UUIDv7: ${value}`); } return value as T;}