/** * @file Container.Types.ts * @author Gage Sorrell * @copyright (c) 2026 Gage Sorrell * @license MIT */ import type { HigherKind } from "../HigherKind/index.ts"; import type { IterableContainer } from "./Container.Meta.Types.ts"; import type { Unsafe } from "./Container.Unsafe.Types.ts"; /** * Get the element type of a given {@link Any | container type}. * * @template ContainerType - The {@link Any | container type} whose element type * is to what this evaluates. */ export type Element = ContainerType extends Array ? ElementType : ContainerType extends Set ? ElementType : ContainerType extends IterableContainer ? ElementType : ContainerType extends HigherKind ? ArgumentVectorType extends readonly [infer ElementType] ? ElementType : never : never; /** * A {@link HigherKind | higher-kinded} container type of a given {@link ElementType}. * * @template ElementType - The type of the elements in this type. */ export type Higher = HigherKind; /** * Any container of a given {@link ElementType}. * * @template ElementType - The type of the elements in this type. */ export type Any = Array | ReadonlyArray | Set | ReadonlySet | IterableContainer | HigherKind | HigherIterable; /** * A {@link Higher | higher-kinded} container type of a given {@link ElementType}, * which also implements the {@link Iterable} interface. * * @template ElementType - The type of the elements in this type. */ export type HigherIterable = Higher & Iterable; /** * The result of an operation in the {@link Container} module. * * If both operands are {@link Array | Arrays}, then the result will also * be an {@link Array}. Otherwise, this will be a {@link Set}. * * @template LeftType - The left {@link Unsafe!Iterable | Iterable} operand * of the given operation. * @template RightType - The right {@link Unsafe!Iterable | Iterable} operand * of the given operation. */ export type Result, RightType extends IterableContainer, LeftElementType = unknown, RightElementType = unknown> = LeftType extends ReadonlyArray ? RightType extends ReadonlyArray ? Array | Element> : Set | Element> : Set | Element>; //# sourceMappingURL=Container.Types.d.ts.map