import type { Reference } from "@knyt/artisan"; import type { SkipRenderSignal } from "./SkipRenderSignal.ts"; /** * A type representing a reference that holds a Promise, or may be undefined. * * @remarks * * This type is a union of two reference types to accommodate both cases: * - a reference to a possibly `undefined` promise * - a reference to a definitely defined promise * * This is necessary because TypeScript does not allow a single reference type * to represent both cases within the `Reference` type. */ export type PromiseReference = Reference.Readonly | undefined> | Reference.Readonly>; export declare namespace PromiseReference { /** * The unwrapped type of a `PromiseReference`. * * @remarks * * If the reference holds a `Promise` or `Promise | undefined`, * the unwrapped type is `U`. Otherwise, it is `never`. * * This type is a union of two conditional types to handle both cases. * This is necessary because TypeScript does not allow a single conditional type * to extract the inner type from both `Promise` and `Promise | undefined`. */ type Unwrapped = T extends Reference.Readonly> ? U : T extends Reference.Readonly | undefined> ? U | undefined : never; /** * A tuple type representing multiple `PromiseReference` types. */ type Collection = [...refs: PromiseReference[]]; namespace Collection { /** * The unwrapped types of a tuple of `PromiseReference` types. */ type Unwrapped = { [K in keyof T]: PromiseReference.Unwrapped; }; } } //# sourceMappingURL=PromiseReference.d.ts.map