/** * @file Array.Internal.Types.ts * @author Gage Sorrell * @copyright (c) 2026 Gage Sorrell * @license MIT */ import type { Options, TArrayType } from "./Array.Types.mjs"; import type { NoOptions } from "../Generic/Option/Option.Types.mjs"; /** * Internal types for the {@link Array} module. * * @internal * * @module Array.Internal */ type TBuildStaticTArrayReadonly = readonly []> = Accumulator["length"] extends ArraySize ? Accumulator : TBuildStaticTArrayReadonly; export type TBuildStaticTArrayMutable = []> = Accumulator["length"] extends ArraySize ? Accumulator : TBuildStaticTArrayMutable; /** * Used to define {@link \@sorrell/utilities/array!TStaticArray}. * @template ElementType - The type of this, or the type of this `Array`. * @template ArraySize - The number of {@link ElementType | ElementTypes} in this `Array`. The * @template ReadonlyType - Whether the built {@link Array} type will be `readonly`. * this type. * @internal */ export type TBuildStaticTArrayBase = ReadonlyType extends true ? TBuildStaticTArrayReadonly : ReadonlyType extends false ? TBuildStaticTArrayMutable : never; export type TBuildStaticTArray = Options.DefinedOnly extends OptionsType ? Options.MaybeDefined extends OptionsType ? never : Options.Readonly extends OptionsType ? TBuildStaticTArrayReadonly, ArraySize> : TBuildStaticTArrayMutable, ArraySize> : Options.MaybeDefined extends OptionsType ? Options.Readonly extends OptionsType ? TBuildStaticTArrayReadonly : TBuildStaticTArrayMutable : Options.Readonly extends OptionsType ? TBuildStaticTArrayReadonly : TBuildStaticTArrayMutable; /** * Wrap a `TArrayType` type with this to change the {@link ElementType} to `ElementType | undefined`. * * @template ArrayType - The type of `TArrayType` to transform. */ export type TWithUndefined = ArrayType extends TArrayType ? TArrayType : never; /** * The opposite of {@link TWithUndefined}. * * @template ArrayType - The type of `TArrayType` to transform. */ export type TWithDefined = ArrayType extends TArrayType ? TArrayType, OptionsType, ArraySize> : never; export {}; //# sourceMappingURL=Array.Internal.Types.d.mts.map