import { makeFluent } from "../base"; import type { HKT } from "../base/hkt"; import { Mixin, type Input, type Props, type Return, } from "../base/mixin"; import type { Empty } from "../internal"; import type { Methods } from "../registry"; import { Base } from "./base"; class Awaited> { public value: T; public constructor(value: T) { this.value = value; } } export interface AwaitedMixin extends Mixin.HKT { new: (t: HKT.T) => Input extends infer T ? T extends Promise ? { readonly awaited: Return, typeof t>; } : 0 : never; } export const AwaitedMixin = Mixin( (value, $, fluent) => {}, ); if (import.meta.vitest) { const { test, expect } = import.meta.vitest; const registry = [Base, AwaitedMixin] as const; const $ = makeFluent(registry); test(".awaited", () => { const promise = new Promise((r) => { r(10); }); const m = $(promise).V; }); }