import type { IObjectOf } from "./object.js"; /** * Generic interface for reference types (value wrappers). */ export interface IDeref { /** * Returns wrapped value. */ deref(): T; } export declare type MaybeDeref = IDeref | T; /** * If `T` is a {@link IDeref}, returns its value type or else `T`. */ export declare type Derefed = T extends IDeref ? ReturnType : T; /** * Constructs a type with a set of properties `K` of type `T` and * attempts to resolve each given key via {@link Derefed}. * * @example * ```ts * interface Foo { * a: IDeref; * b: IDeref; * c: { d: number }; * } * * type Foo2 = DerefedKeys; * // { a: string; b: number; c: { d: number; } } * * type Foo3 = DerefedKeys; * // { b: number; } * ``` */ export declare type DerefedKeys, K extends keyof T = keyof T> = { [P in K]: Derefed; }; /** * Returns true iff `x` implements {@link IDeref}. * * @param x - */ export declare const isDeref: (x: any) => x is IDeref; /** * If `x` implements {@link IDeref}, returns its wrapped value, else * returns `x` itself. * * @param x - */ export declare const deref: (x: MaybeDeref) => T; //# sourceMappingURL=deref.d.ts.map