Zod: TypeScript 스키마 검증
·
TypeScript
# 설치npm install zod기본 사용법import { z } from "zod";// 기본 스키마 정의const userSchema = z.object({ name: z.string(), age: z.number().min(0), email: z.string().email(), website: z.string().url().optional()});// 타입 추론type User = z.infer;// 데이터 검증try { const user = userSchema.parse({ name: "John", age: 30, email: "john@example.com" });} catch (error) { console.error(error);}고급 스키마 정의const a..