UNPKG

rivo

Version:

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

30 lines (26 loc) • 1.12 kB
import type { List } from "."; // @ts-ignore - `Concat` is only used in doc comments import type { Concat } from "./Concat"; import type { Args, GenericFn, GenericResolver } from "../HKT"; /** * Less strict version of {@link Concat}.The **W** suffix (short for **W**idening) means that both * {@link List}s can hold different types. * * Sig: `<T, U>(xs: List<T>, ys: List<U>) => List<T | U>` */ export type ConcatW<TS extends List, US extends List> = TS extends unknown[] ? [...TS, ...US] : readonly [...TS, ...US]; interface Resolver extends GenericResolver<[List, List], List> { on1_: ([xs]: Args<this>) => [[List], List]; on_1: ([, ys]: Args<this>) => [[List], List]; on11: ([xs, ys]: Args<this>) => [[], List<(typeof xs)[number] | (typeof ys)[number]>]; } /** * [Fn] Less strict version of {@link Concat}. The **W** suffix (short for **W**idening) means that * both {@link List}s can hold different types. * * Sig: `<T, U>(xs: List<T>, ys: List<U>) => List<T | U>` */ export default interface ConcatWFn extends GenericFn<Resolver> { def: ([xs, ys]: Args<this>) => ConcatW<typeof xs, typeof ys>; }