Dynz.

Installation

Install dynz and its optional framework integrations.

Requirements

  • Node.js 18 or later
  • TypeScript 5.0 or later (strict mode recommended)

Install the core package

npm install dynz

That's it for server-side validation or any environment that doesn't need a React integration.

Install the React Hook Form integration

If you're building React forms, add the integration package alongside its peer dependencies:

npm install @dynz/react-hook-form react-hook-form @hookform/resolvers

TypeScript setup

Dynz uses TypeScript's const type parameters and tuple inference extensively. Enable strict mode in your tsconfig.json to get the best type inference:

tsconfig.json
{
  "compilerOptions": {
    "strict": true,
    "moduleResolution": "bundler"
  }
}

Verify your setup

Create a file and run it to confirm everything installed correctly:

check.ts
import * as d from 'dynz';

const schema = d.object({
  name: d.string().min(1),
  age:  d.number().min(0),
});

const result = await d.validate(schema, undefined, { name: 'Alice', age: 30 });

console.log(result.success); // true
console.log(result.values);  // { name: 'Alice', age: 30 }

validate() is async. Use await or .then() when calling it.

On this page