-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
I was trying this today:
const schema = z.templateLiteral(["0x", z.string()]).default("0x")And I was expecting that alongside z.input I could pass like an env var to it
const value: z.input<typeof schema> = process.env.PRIVATE_KEYBut it doesn't work because the z.input for templateLiteral is the same as the output type.
I'm not sure if this is expected or not, but it was counter-intuitive for me.
(For reference, we use Zod a lot to parse env variables into config objects where we want to at least validate that the "shape" is correct, that is, the keys are correct and that the fields are strings).
Metadata
Metadata
Assignees
Labels
No labels