import type { Ary } from "."; import type { Args, GenericFn, GenericResolver } from "../HKT"; /** * Mix a type with the element type of an {@link Ary} (i.e., `Array` or `ReadonlyArray`). * * Sig: `(y: U, a: Ary) => Ary` * * @example * ```typescript * type R1 = Mix; * // ^?: (string | number)[] * type R2 = Mix<"foo", readonly number[] >; * // ^?: readonly (number | "foo")[] * ``` */ export type Mix = A extends unknown[] ? Array : ReadonlyArray; interface Resolver extends GenericResolver<[unknown, Ary], Ary> { on1_: ([y]: Args) => [[Ary], Ary]; on_1: ([, a]: Args) => [[unknown], Ary]; on11: ([y, a]: Args) => [[], Mix]; } /** * [Fn] Mix a type with the element type of an {@link Ary} (i.e., `Array` or `ReadonlyArray`). * * Sig: `(y: U, a: Ary) => Ary` */ export default interface MixFn extends GenericFn { def: ([y, a]: Args) => Mix; }