Closed
Description
Description
Given the below code:
const myEnum = z.enum(["left", "right", "center", "justify"]);
const myObject = z.object({ myEnum: myEnum });
type MyObject = z.infer<typeof myObject>;
type MyObjectInput = z.input<typeof myObject>;
I would expect MyObjectInput to be of type:
type MyObjectInput = {
myEnum: "left" | "right" | "center" | "justify";
}
Actual Result
The inferred type signature of MyObjectInput
is shown as:
type MyObjectInput = {
myEnum: z.core.$InferEnumInput<{
left: "left";
right: "right";
center: "center";
justify: "justify";
}>;
}
NOTE: This is only an issue with MyObjectInput
, not MyObject
(i.e. output type).
Metadata
Metadata
Assignees
Labels
No labels