rivo
Version:
🤖 The ultimate library you need for composable type-level programming in TypeScript, powered by HKT.
46 lines (42 loc) • 1.66 kB
TypeScript
import type { List } from ".";
import type { ConcatW } from "./ConcatW";
// @ts-ignore - Only used in doc comments
import type ConcatWFn from "./ConcatW";
// @ts-ignore - Only used in doc comments
import type { ExtendLeft } from "./ExtendLeft";
// @ts-ignore - Only used in doc comments
import type ExtendLeftFn from "./ExtendLeft";
// @ts-ignore - Only used in doc comments
import type { ExtendW } from "./ExtendW";
// @ts-ignore - Only used in doc comments
import type ExtendWFn from "./ExtendW";
import type { Args, GenericFn, GenericResolver } from "../HKT";
/**
* Less strict version of {@link ExtendLeft}.The **W** suffix (short for **W**idening) means that
* both {@link List}s can hold different types.
*
* It is actually an alias of {@link ConcatW}.
*
* Sig: `<T, U>(ys: List<U>, xs: List<T>) => List<T | U>`
*
* @see {@link ExtendW} for the opposite.
*/
export type ExtendLeftW<US extends List, TS extends List> = ConcatW<US, TS>;
interface Resolver extends GenericResolver<[List, List], List> {
on1_: ([ys]: Args<this>) => [[List], List];
on_1: ([, xs]: Args<this>) => [[List], List];
on11: ([ys, xs]: Args<this>) => [[], List<(typeof xs)[number] | (typeof ys)[number]>];
}
/**
* [Fn] Less strict version of {@link ExtendLeftFn}.The **W** suffix (short for **W**idening) means
* that both {@link List}s can hold different types.
*
* It is actually an alias of {@link ConcatWFn}.
*
* Sig: `<T, U>(ys: List<U>, xs: List<T>) => List<T | U>`
*
* @see {@link ExtendWFn} for the opposite.
*/
export default interface ExtendLeftWFn extends GenericFn<Resolver> {
def: ([ys, xs]: Args<this>) => ConcatW<typeof ys, typeof xs>;
}