Skip to content

Commit

Permalink
chore: README update
Browse files Browse the repository at this point in the history
Improve documentation to explain how to reuse a configured Zod instance between different schema files.
  • Loading branch information
maykon-oliveira authored Jan 16, 2024
1 parent ab13caf commit 8d1e85d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ i18next.init({
});
z.setErrorMap(zodI18nMap);

// export configured zod instance
export { z }
```

Import wherever it's required

```ts
import { z } from "./es-zod";

const schema = z.string().email();
// Translated into Spanish (es)
schema.parse("foo"); // => correo inválido
Expand Down

0 comments on commit 8d1e85d

Please sign in to comment.