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
If you have existing string union types, enum requires both generics to be defined in order to type guard against the input. Example:
import{z}from'zod';typeTColors='Red'|'Green'|'Blue';// Type errorz.enum<TColors>(["Red","Green","Blue"]);// Successz.enum<TColors,[TColors, ...TColors[]]>(["Red","Green","Blue"]);
To get around this, the createZodEnum overrides need a default generic for the second parameter
If you have existing string union types, enum requires both generics to be defined in order to type guard against the input. Example:
To get around this, the
createZodEnum
overrides need a default generic for the second parameterThe text was updated successfully, but these errors were encountered: