zod
zod copied to clipboard
Can `ZodType` generic default be changed to `unknown`?
Proposed Change
class ZodType<
- Output = any,
+ Output = unknown,
Def extends ZodTypeDef = ZodTypeDef,
Input = Output
Example
I have seen this kind of wrapper function where z.Schema
is missing the generic
// returns any
function parse(value: unknown, schema: z.Schema) {
// do some other stuff ...
return schema.parse(value)
}
I think it would be safer, if this function would return unknown
by default.
Is there a reason why the generic in ZodType
needs to defaults to any
besides ergonomics?
Feel free to close or turn this into a discussion :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.