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
and want the zod-type to use be UserId instead of string.
Using refine seems to work, but I hope, that there is a better way that can avoid the function call:
constMySchema=z.object({id: z.string().refine((v): v is UserId=>true),});typeMySchemaType=z.infer<typeofMySchema>;// type MySchemaType = {// id: string & Flavoring<"UserId">;// }
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
e.g. we use a Flavor type UserId
and want the zod-type to use be UserId instead of string.
Using refine seems to work, but I hope, that there is a better way that can avoid the function call:
Beta Was this translation helpful? Give feedback.
All reactions