# zod | Colin McDonnell | Knowledge Base | Instagit

TypeScript-first schema validation with static type inference

GitHub Stars: 41.9k

Repository: https://github.com/colinhacks/zod

---

## Articles

### [How to Validate Map and Set Collections with Zod: Complete Guide](/colinhacks/zod/how-to-use-zods-map-and-set-validation-schemas)

Master Zod map and set validation. Learn to validate Map and Set collections with key/value schemas, size constraints, and async refinements for robust data handling. Get the complete guide.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod's Record for Key-Value Validation: Syntax, Examples, and Source Code](/colinhacks/zod/how-to-use-zods-record-for-key-value-validation)

Master Zod's record for key-value validation. Learn syntax and see examples to ensure your dictionary objects meet specific key and value schema requirements. Read now.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod's Lazy for Self-Referential Schemas](/colinhacks/zod/how-to-use-zods-lazy-for-self-referential-schemas)

Learn to use Zod's lazy for self-referential schemas. Defer evaluation of circular types with z.lazy to prevent ReferenceError and maintain TypeScript inference for recursive data.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod Union and Enum Types: A Complete Guide](/colinhacks/zod/how-to-use-zods-union-and-enum-types)

Master Zod union and enum types to validate against multiple shapes or literal values. Get runtime validation and full TypeScript inference with this complete guide.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Combine Schemas with Zod's Intersection](/colinhacks/zod/how-to-combine-schemas-with-zods-intersection)

Discover how to combine schemas with Zod's intersection combinator. Learn to merge validators for simultaneous input satisfaction and a compile-time TypeScript intersection type, enhancing your data validation.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Define Recursive Types in Zod: A Complete Guide to z.lazy](/colinhacks/zod/how-to-define-recursive-types-in-zod)

Master recursive types in Zod with z.lazy Learn to define self-referencing schemas and break circular dependencies for robust data validation in your TypeScript projects

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod's pick and omit for Partial Object Types: A Complete Guide](/colinhacks/zod/how-to-use-zods-pick-and-omit-for-partial-object-types)

Master Zod pick and omit to create partial object types. Select or exclude keys from Zod schemas for precise data shaping and type safety in your JavaScript projects.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod's Mask Method for Partial Field Handling](/colinhacks/zod/how-to-use-zods-mask-method-for-partial-field-handling)

Master Zod's mask method to selectively handle partial fields. Learn how to update specific schema fields using truthy masks for efficient data validation.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod's Catch Method for Default Values on Parse Failures](/colinhacks/zod/how-to-use-zods-catch-method-for-default-values-on-parse-failures)

Learn how to use Zod's catch method to provide default values on parse failures, preventing errors and ensuring valid data in your application. Simplify data handling with Zod.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod Pipeline Transform for Chained Schema Validation](/colinhacks/zod/how-to-use-zods-pipeline-transform-for-chained-transformations)

Discover how to use Zod pipeline transform for chained schema validation. Compose schemas for type-safe transformations with automatic error short-circuiting. Learn more now.

- Tags: tutorial
- Published: 2026-02-23

### [How to Implement Discriminated Unions in Zod: A Complete Guide](/colinhacks/zod/how-to-implement-discriminated-unions-in-zod)

Learn how to implement discriminated unions in Zod with z.discriminatedUnion. Achieve O(1) lookup and precise errors for robust data validation.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod's preprocess for Pre-Parsing Data Transformation](/colinhacks/zod/how-to-use-zods-preprocess-for-pre-parsing-data-transformation)

Learn how to use Zod preprocess for data transformation before validation. Transform, sanitize, and coerce data effectively with Zod pipes for robust error handling.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod Encode Decode Methods for Bidirectional Data Transformation](/colinhacks/zod/how-to-use-zods-encode-decode-methods-for-data-transformation)

Learn how to use Zod encode decode methods for safe bidirectional data transformation. Safely serialize and deserialize data with full type safety using Zod.

- Tags: how-to-guide
- Published: 2026-02-23

### [When to Use safeParse vs parse in Zod: Complete Guide](/colinhacks/zod/when-to-use-safeparse-vs-parse-in-zod)

Master Zod with this guide on safeParse vs parse. Choose parse for immediate error aborts and safeParse for value-based validation handling without exceptions.

- Tags: deep-dive
- Published: 2026-02-23

### [How to Create Custom Refinements in Zod Using refine and superRefine](/colinhacks/zod/how-to-create-custom-refinements-using-zods-refine-and-superrefine-methods)

Master Zod custom refinements with refine and superRefine. Learn to build robust validation, handle multiple errors, and control validation flow for your schemas.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod's ISO Date/Time Schemas: Complete Guide to z.datetime(), z.date(), z.time(), and z.duration()](/colinhacks/zod/how-to-use-zods-iso-date-time-schemas)

Master Zod's ISO date and time schemas, including z.datetime(), z.date(), z.time(), and z.duration(). Validate temporal data efficiently with this comprehensive guide.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Handle and Customize Zod Parsing Errors: A Complete Guide](/colinhacks/zod/how-to-handle-and-customize-zod-parsing-errors)

Master Zod parsing errors! Learn to handle and customize ZodError messages at schema, parse-time, global, or locale levels with detailed error maps for better validation.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod's Coercion Features for Automatic Type Conversion](/colinhacks/zod/how-to-use-zods-coercion-features-for-automatic-type-conversion)

Learn how to use Zod's coercion features for automatic type conversion. Zod seamlessly converts input values to target primitives during parsing, simplifying your data validation.

- Tags: how-to-guide
- Published: 2026-02-23

### [How to Use Zod Branded Types for Type Narrowing and Stricter Type Safety](/colinhacks/zod/how-to-use-zods-branded-types-for-type-narrowing-and-stricter-typing)

Learn how to use Zod branded types to add nominal markers for superior type narrowing and stricter type safety with zero runtime overhead. Enhance your Zod schema validation today.

- Tags: deep-dive
- Published: 2026-02-23

