Zod naming convention
What is the best naming convention for zod?
both capitalized
const Object = z.object(...)
type Object = z.infer<...>
-or-
only type capitalized
const object = z.object(...)
type Object = z.infer<...>
7 Replies
i dont think there a convention
just make them readable and it will be good enough
usually u use something like
hmm so you use different names?
I usually go by
there really isn't any wrong way to do it as long as u aren't misrepresenting it with a stupid name. Like the schema being responsible for log in and you instead call it "createUser"
yeah that's pretty much what I'm doing, I was capitalizing both at first but thought it might lead to confusion
The convention with T in front is from C# I think, its upto you if you want to incorporate it. Usually having it as capitalized is enough to differentiate it in my eyes but u know how divided people can be on some things
just do what works best for u and ur team
The T is just a optional "reminder" of sorts that is a type
As long you can know that something is a type, it's a good use
Yeah I'm not knocking it. I picked it up for a bit and wasn't consistent with its usage so I just fell back to caps