You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, this tends to be a limitation of TypeScript inference -- you'll often find you either need to declare things inline to make it work, or else add explicit annotations (possibly including as const). This tends to be true for other tooling that leans heavily on TypeScript inference like tRPC, so it's not exclusive to zod or znv.
In general when you encounter problems like these I'd recommend removing as many explicit annotations as possible and letting the inference do the work for you.
ReturnType is a built-in TypeScript utility type. But as an aside, by the same principle of making sure an explicit annotation isn't just getting in the way of letting TypeScript infer things automatically, you might find you don't actually need an explicit Environment type, depending on usage -- using ReturnType can sometimes be an antipattern.
Can not use an array in the schema: Error TS2322 on
parseEnv
_Code to reproduce the error
Stacktrace
The text was updated successfully, but these errors were encountered: