import type { M } from "ts-algebra"; import type { JSONSchema } from "../definitions"; import type { ParseSchema, ParseSchemaOptions } from "./index"; import type { MergeSubSchema } from "./utils"; export type IfThenElseSchema = JSONSchema & { if: JSONSchema; then?: JSONSchema; else?: JSONSchema; }; export type ParseIfThenElseSchema, IF_SCHEMA extends JSONSchema = MergeSubSchema, PARSED_THEN_SCHEMA = IF_THEN_ELSE_SCHEMA extends { then: JSONSchema; } ? M.$Intersect, ParseSchema, OPTIONS>> : ParseSchema, PARSED_ELSE_SCHEMA = IF_THEN_ELSE_SCHEMA extends { else: JSONSchema; } ? M.$Intersect, ParseSchema>, ParseSchema, OPTIONS>> : M.$Exclude, ParseSchema>> = M.$Intersect, ParseSchema>;