UNPKG

@manuth/interceptor

Version:

Provides a convenient way to intercept method- property- and accessor-calls of an object.

39 lines (38 loc) 1.05 kB
import { IInterception } from "./IInterception.js"; /** * Represents a collection of interceptions. * * @template T * The type of the target of the interceptions. */ export declare class InterceptionCollection<T extends {}> extends Map<keyof T, IInterception<T, keyof T>> { /** * Gets an interception of the collection. * * @template TKey * The type of the specified {@linkcode key}. * * @param key * The key whose interception to get. * * @returns * The interception with the specified {@linkcode key}. */ get<TKey extends keyof T>(key: TKey): IInterception<T, TKey>; /** * Sets an interception of the collection. * * @template TKey * The type of the specified {@linkcode key}. * * @param key * The key whose interception to set. * * @param interception * The interception to set. * * @returns * This collection. */ set<TKey extends keyof T>(key: TKey, interception: IInterception<T, TKey>): this; }