isSchema
A type guard to check if a value is a valid zod schema.
1import { isSchema } from '@conform-to/zod/v3/future';
2// or
3import { isSchema } from '@conform-to/zod/v4/future';
4
5if (isSchema(value)) {
6 // value is a ZodTypeAny
7}#Parameters
value
The value to check.
#Returns
Returns true if the value is a valid zod schema, false otherwise.
#Example
Use isSchema to restrict what schema types your forms accept. This narrows down the types for the validateSchema option:
1import { configureForms } from '@conform-to/react/future';
2import { isSchema } from '@conform-to/zod/v3/future';
3
4const { useForm } = configureForms({
5 isSchema,
6 validateSchema(schema, payload) {
7 // schema is now typed as ZodTypeAny
8 },
9});