Infers the TypeScript type of a DiscriminatedUnionFieldDef.
Iterates over the variant keys and for each produces a union member that is { [discriminator]: VariantKey } & InferObjectSchema<VariantSchema>.
{ [discriminator]: VariantKey } & InferObjectSchema<VariantSchema>
// Given: discriminator: "kind", variants: { circle: { radius: { type: "number" } }, square: { side: { type: "number" } } }// Produces: { kind: "circle"; radius: number } | { kind: "square"; side: number } Copy
// Given: discriminator: "kind", variants: { circle: { radius: { type: "number" } }, square: { side: { type: "number" } } }// Produces: { kind: "circle"; radius: number } | { kind: "square"; side: number }
Infers the TypeScript type of a DiscriminatedUnionFieldDef.
Iterates over the variant keys and for each produces a union member that is
{ [discriminator]: VariantKey } & InferObjectSchema<VariantSchema>.