Zod

Z

Zod

Discussion for Zod, a runtime type library for TypeScript, and the surrounding ecosystem of libraries.

Join

Leozinn - i'm compiled my project, and interfac...

i'm compiled my project, and interfaces.d.ts return this... How am I going to use typing in my project, if it is like a zod object?...
No description

hinogi - tsconst a = z.object({ foo: z.strin...

```ts const a = z.object({ foo: z.string() }) ...
Solution:
ok so foo has to be foo: null | undefined and {} is not a valid solutions. also, if null, the key will persist, if undefined the key is gone 😄 thanks playground

versace - hey!I am currently investigating wh...

hey! I am currently investigating what the best approach for using header validation through zod would be in regards to key case sensitivity. i'm currently in a situation where I need to have support for all headers to be supported regardless of how the casing looks when sent in from the request. any suggestions?...
Solution:
Do you need to preserve the case of the incoming headers? You could transform them at runtime with .toLowerCase() and then build your schema on the lowercased keys.