UNPKG

@typescript-package/wrapped-descriptor

Version:

A lightweight TypeScript library for wrapped property descriptor.

43 lines (42 loc) 2.25 kB
import { WrappedDescriptorBase } from './wrapped-descriptor-base.abstract'; import { WrappedPropertyDescriptor } from '@typedly/descriptor'; /** * @description The concrete implementation of wrapped property descriptor. * @export * @class WrappedDescriptor * @template [O=any] The type of the object to define the descriptor on. * @template {keyof O} [K=keyof O] The key of the object to define the descriptor on. * @template {K extends keyof O ? O[K] : any} [V=K extends keyof O ? O[K] : any] The value type of the key in the object. * @template {boolean} [A=boolean] The type of active. * @template {boolean} [N=boolean] The type of enabled. * @template {boolean} [C=boolean] The type of configurable. * @template {boolean} [E=boolean] The type of enumerable. * @template {WrappedDescriptor<O, K, V, A, N, C, E, D> | PropertyDescriptor} [D=WrappedDescriptor<O, K, V, A, N, C, E, any>] The type of the previous descriptor. * @extends {WrappedDescriptorBase<O, K, V, A, N, C, E, D>} */ export declare class WrappedDescriptor<O = any, K extends keyof O = keyof O, V extends K extends keyof O ? O[K] : any = K extends keyof O ? O[K] : any, A extends boolean = boolean, N extends boolean = boolean, C extends boolean = boolean, E extends boolean = boolean, D extends WrappedDescriptor<O, K, V, A, N, C, E, D> | PropertyDescriptor = WrappedDescriptor<O, K, V, A, N, C, E, any>> extends WrappedDescriptorBase<O, K, V, A, N, C, E, D> { #private; /** * @description The string tag for the descriptor. * @public * @readonly * @type {string} */ get [Symbol.toStringTag](): string; /** * @inheritdoc */ get get(): (this: O, descriptor?: D | undefined) => V; /** * @inheritdoc */ get set(): (this: O, value: V, descriptor?: D | undefined) => void; /** * Creates an instance of `WrappedDescriptor`. * @constructor * @param {O} object The object to define the descriptor on. * @param {K} key The key of the object to define the descriptor on. * @param {Partial<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>>} attributes */ constructor(object: O, key: K, attributes?: Partial<WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>>); }