714 questions
0
votes
1
answer
15
views
Using coerce is showing red squiggly lines elsewhere in WebStorm
I am using TypeScript in a learning / test NextJS app using WebStorm 2025.3.2.
My WebStorm is showing red squiggly lines under onSubmit (2nd OnSubmit keyword) for
return <form onSubmit={...
1
vote
2
answers
40
views
React-hook-form validation not using Async custom validation with nextJs and ZOD resolver
I am using react-hook-form 7.71.0, zod 4.3.5, and nextjs 16.1.0.
I have the validation routine that works when called directly in code.
I am using better-auth to check whether a user has been created ...
1
vote
1
answer
43
views
React Hook Form + zodResolver: how to add field-level (async) validation that depends on hook data?
I’m using React Hook Form with Zod via zodResolver(schema).
For most fields, schema validation is fine, but I have a field that needs extra validation based on data fetched inside the field component (...
0
votes
1
answer
47
views
Error thrown when I try to console log a ZodError
I discovered that running console.log on a ZodError would result in an error being thrown.
e.g.
import z from 'zod'
const schema = z.string()
const { error } = schema.safeParse(3)
console.log(error)
...
3
votes
1
answer
144
views
TypeScript Error with react-hook-form and zodResolver: Type 'unknown' not assignable to 'string | number'
How can I properly type react-hook-form with zodResolver when using z.coerce.number() for form inputs? The schema seems to correctly infer the types as numbers, but TypeScript is complaining about ...
0
votes
1
answer
78
views
How to see JSON Schema created with zod?
I am trying to log a JSON Schema created with zod. I tried converting to JSON Schema with zod-to-json-schema in Node.js. Here is what I see from console.log(jsonSchema):
{ '$schema': 'http://json-...
1
vote
0
answers
73
views
How to work with discriminatedUnion and zodEffects effectively?
I have this zod schema with a discriminatedUnion:
const mySchema = baseTypeSchema.extend({
id: z.string(),
name: z.string(),
specificData: z.discriminatedUnion("type", [...
0
votes
1
answer
201
views
Uncaught (in promise) ZodError
I am working on an input form for adding a food item, but I am encountering an error that I've been unable to resolve and need help with. Below is the code:
const schema = zod.object({
name: zod....
3
votes
1
answer
241
views
Zod email validation issue
Issue
I'm working on a React application and wanted to try the newest version of Zod (4.1.13) for input validations along with react hook form. I've been struggling with the z.email() function as it's ...
2
votes
0
answers
101
views
Lost OpenAPI descriptions when using recursive Zod schema transformation with zod-to-openapi
I'm using @asteasolutions/zod-to-openapi to generate OpenAPI documentation from Zod schemas. I have a recursive utility function makeSchemaDeepNullable that transforms all fields in a schema to ...
1
vote
0
answers
154
views
How to create optional value with Tanstack form and Zod?
How to create optional value with Tanstack form and Zod?
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { z } from 'zod';
import { revalidateLogic, ...
2
votes
0
answers
75
views
React Hook Form does not upadate `errors` field on parent when triggering children
I have the following schema in my RHF form:
const latexSchema = z.string().refine(
() => {
return solutionRef.current?.editor?.state.doc.textContent.length! >= 10;
},
'Wymagane jest co ...
0
votes
0
answers
58
views
How to handle API responses with null values while maintaining strict input validation in TypeScript/Moleculer?
I'm building a microservice with Moleculer.js and TypeScript, using Zod v4 for schema validation. I need to validate API responses that return null for optional fields, while keeping strict validation ...
1
vote
1
answer
127
views
How to make part of a Zod schema optional only on submit?
I have a React project using TypeScript, React Hook Form, and Zod.
My Zod schema looks like this:
import { z } from 'zod';
export const loyaltyNmvFormSchema = z.object({
maxPoint: z.coerce.number()....
2
votes
1
answer
128
views
How to insert into postgres temporal tables with kyselyjs?
I have a database that has some temporal tables. I have zod schemas for those tables and I am using those zod schemas to define the tables in Kysely. The schemas can be as follows:
CREATE TABLE ...