-
-
Couldn't load subscription status.
- Fork 7
Open
Description
type ContrivedType = 1 | -1 | null;
const contrivedZod: toZod<ContrivedType> = z.union([z.literal(1), z.literal(-1), z.null()]);
ts complains:
Type 'ZodUnion<[ZodLiteral<1>, ZodLiteral<-1>, ZodNull]>' is not assignable to type 'ZodNullable<never> | ZodNullable<never>'.
Property 'unwrap' is missing in type 'ZodUnion<[ZodLiteral<1>, ZodLiteral<-1>, ZodNull]>' but required in type 'ZodNullable<never>'.
If you remove toZod and do z.infer:
type ContrivedTypeInfer = z.infer<typeof contrivedZod>;
The inferred type is exactly type ContrivedTypeInfer = 1 | -1 | null
Metadata
Metadata
Assignees
Labels
No labels