colinhacks / zod

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

Add `invalid_literal` ZodIssueCode to documentation #3602

Open ghidalgo93 opened 2 months ago

ghidalgo93 commented 2 months ago

Hello there, new to zod and super happy with it, thank you so much for your work!

As I was playing around with implementing zod into my ts projects I realized I was getting some invalid_literal error codes in my zod issues array (mostly in union validation errors). I tried looking up the invalid_literal code in the general project gh docs as well as your error handling docs to see what extra fields I can expect and it seems to be missing from those docs. I do see this error code in the source code so I'm assuming I didn't find a bug, just possibly some missing docs.

Figured I'd bring it up in case you weren't aware or in the case I'm missing/confused about how the invalid_literal code is supposed to be used.