Skip to content

isZodSchema

isZodSchema(value): value is ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>

Defined in: packages/contracts/src/event-stream.ts:156

Whether a value walks and quacks like a zod schema.

Duck-typed on safeParse (the capability appendEvent and the ingest endpoint actually use) rather than instanceof z.ZodType: zod is a PEER dependency, so a consumer with a duplicated zod install would fail an instanceof against a schema that is perfectly usable.

unknown

value is ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>