import type { Rhodium } from "./Rhodium.mts"; import type { doesReduceTo } from "./internal/subtypeDetection.mts"; /** * The same as the return type of {@linkcode Rhodium.resolve}: * - A synchronous value becomes a Rhodium of {@link Errored error type} `never` * - A {@link PromiseLike promise-like} value becomes a Rhodium of {@link Errored error type} `unknown` * - A {@link Rhodium} stays the same */ export type ToRhodium = T extends Rhodium ? T : T extends PromiseLike ? Rhodium, unknown> : Rhodium; /** * Similarly to {@linkcode Awaited}, which returns the resolution type, * {@linkcode Errored} returns the error type. */ export type Errored = T extends Rhodium ? E : T extends PromiseLike ? unknown : never; /** Performs subtype reduction on a union of Rhodiums. */ type RawMergedSoft

> = P extends Rhodium ? Rhodium : never; /** Joins a union of Rhodiums into a single union, R and E get subtype reduced. */ type RawMergedHard

> = [P] extends [ Rhodium ] ? Rhodium : never; /** * Merges a union of {@link Rhodium Rhodiums} into a single type, * only when such a merge would not lose type information. * @example ``` * type M = Merged | Rhodium> * // ^? M: Rhodium<1, 2> * ``` */ export type Merged

> = doesReduceTo, RawMergedHard

, P, RawMergedHard

>; export {};