import { TObject, TUnion } from "typebox"; //#region src/util/union-schema.d.ts /** * What a union may hold: an object, or another union of the same — so unions compose. Grouping * variants and composing the groups (`T.Union([Electronic, Manual])`) is the natural way to build a * large union up, and TypeBox supports it: `T.Static` reads a nested union as one flat union of * objects, exactly as if it had been written flat. */ type UnionMember = TObject | TUnion; /** A union of object variants, at any nesting depth. */ type UnionSchema = TUnion; /** * Every object variant of a union schema, with nested unions flattened away — the type-level * counterpart to `flattenVariants`, for the helpers that walk `anyOf` on the type rather than the * value. Without it a nested member fails an `extends TObject` test and collapses to `never`, * silently dropping that whole branch's fields. */ type UnionVariants = T extends TUnion ? UnionVariants : T extends TObject ? T : never; /** * Every object variant in a union, with nested unions flattened away. * * TypeBox does *not* normalize nesting: `T.Union([A, T.Union([B, C])])` keeps two members in * `anyOf`, one of which is itself a union. So while the static type flattens to `A | B | C`, code * walking `anyOf` has to flatten too — reading `.properties` off a nested union finds nothing and * throws. `Value.Check` and `Value.Clean` already recurse, so once the variant list is flat the * nesting makes no difference anywhere. */ declare function flattenVariants(schema: UnionSchema): TObject[]; //#endregion export { flattenVariants as i, UnionSchema as n, UnionVariants as r, UnionMember as t }; //# sourceMappingURL=union-schema-B-Lsy588.d.mts.map