UNPKG

rivo

Version:

🤖 The ultimate library you need for composable type-level programming in TypeScript, powered by HKT.

47 lines (43 loc) • 1.51 kB
import type { List } from "."; import type { Concat } from "./Concat"; // @ts-ignore - Only used in doc comments import type ConcatFn from "./Concat"; // @ts-ignore - Only used in doc comments import type { Extend } from "./Extend"; // @ts-ignore - Only used in doc comments import type ExtendFn from "./Extend"; import type { Args, GenericFn, GenericResolver } from "../HKT"; import type { Broaden } from "../helpers"; /** * Extend a {@link List} by concatenating another {@link List} on the **left**. * * It is actually an alias of {@link Concat}. * * Sig: `<T>(ys: List<T>, xs: List<T>) => List<T>` * * @see {@link Extend} for the opposite. */ export type ExtendLeft<US extends List, TS extends List> = Concat<US, TS>; interface Resolver extends GenericResolver<[List, List], List> { on1_: ([ys]: Args<this>) => [ [List<Broaden<(typeof ys)[number]>>], List<Broaden<(typeof ys)[number]>>, ]; on_1: ([, xs]: Args<this>) => [ [List<Broaden<(typeof xs)[number]>>], List<Broaden<(typeof xs)[number]>>, ]; on11: ([ys, xs]: Args<this>) => [[], List<(typeof xs)[number] | (typeof ys)[number]>]; } /** * [Fn] Extend a {@link List} by concatenating another {@link List} on the **left**. * * It is actually an alias of {@link ConcatFn}. * * Sig: `<T>(ys: List<T>, xs: List<T>) => List<T>` * * @see {@link ExtendFn} for the opposite. */ export default interface ExtendLeftFn extends GenericFn<Resolver> { def: ([ys, xs]: Args<this>) => Concat<typeof ys, typeof xs>; }