Installation
Requirements
- TypeScript 4.5+!
- You must enable
strict
mode in yourtsconfig.json
. This is a best practice for all TypeScript projects.
ts
// tsconfig.json
{
// ...
"compilerOptions": {
// ...
"strict": true
}
}
Install from npm
bash
npm install zod # npm
yarn add zod # yarn
pnpm add zod # pnpm
bun add zod # bun
deno add npm:zod # deno
Use with CDN
html
<script src="https://unpkg.com/zod"></script>
Use with Deno
ts
import { z } from "https://deno.land/x/zod/mod.ts";