-
-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Description
When defining an enum array field in a ZenStack type definition, the generated TypeScript type produces a union of individual enum values instead of an array of enum values.
ZModel Schema:
enum ShirtColor {
Black
White
Red
Green
Blue
}
type Configuration {
teamColors ShirtColor[]? // This should be an optional array
}Generated Schema (correct):
In .generated/zenstack/schema.ts:
teamColors: {
name: "teamColors",
type: "ShirtColor",
optional: true,
array: true // ✅ Correctly marked as array
}
Generated type:
type TestConfiguration = TypeDefResult<SchemaType, "Configuration">
// teamColors is typed as "Black" | "White" | "Red" | "Green" | "Blue" | "Yellow" | "Cyan" | "Magenta" | "Gray" | null;Excpected
For an enum array field like teamColors ShirtColor[]?, the generated TypeScript type should be teamColors?: ShirtColor[] | null | undefined
ymc9
Metadata
Metadata
Assignees
Labels
No labels