Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 22x | import type { Fluent } from ".";
import { never } from "../internal";
import type { Registry } from "../registry";
import type { HKT } from "./hkt";
export interface Props {
readonly value: unknown;
readonly meta: { registry: Registry };
}
type MixinHKT = HKT<Props>;
type MixinFn = (
value: unknown,
fluent: Record<PropertyKey, unknown>,
callback: (value: unknown) => never,
) => void;
export interface Mixin<T extends MixinHKT = MixinHKT> {
hkt: T;
fn: MixinFn;
}
export function Mixin<T extends MixinHKT>(fn: MixinFn): Mixin<T> {
return {
hkt: never,
fn,
};
}
export namespace Mixin {
export type HKT = MixinHKT;
export type Function = MixinFn;
}
export declare const shim: unique symbol;
export interface Shim {
input?: unknown;
output?: HKT;
value?: unknown;
}
export type Input<P extends Props> = P["value"] extends infer T
? T extends { [shim]: { input: infer I } }
? I
: T
: never;
export type Return<T, P extends Props> = Fluent<
P["value"] extends { [shim]: { output: infer U extends HKT } }
? HKT.Apply<U, T>
: T,
P["meta"]["registry"]
>;
export type Instansiate<
M extends Mixin,
T,
Reg extends Registry,
> = HKT.Apply<M["hkt"], { value: T; meta: { registry: Reg } }>;
|