colinhacks / zod

TypeScript-first schema validation with static type inference
https://zod.dev
MIT License
33.09k stars 1.15k forks source link

Question: is it correct to assume that ZodIssue[] will always equal NonEmptyArray<ZodIssue> if the result of safeParse(schema).succes is false? #3721

Open gerkim62 opened 4 weeks ago

gerkim62 commented 4 weeks ago

I can't find in the source code what criteria will determine whether to return success as true or false. i want to assume that if issues.length===0 then it returns success as true in which case casting ZodIssue[] as NonEmptyArray would be fine. but i want to be sure instead of checking everytime