@typescript-package/descriptor-chain
Version:
A lightweight TypeScript library for property descriptor chain.
153 lines (152 loc) • 4.07 kB
TypeScript
import { DescriptorChainCore } from './descriptor-chain-core.abstract';
import { WrappedPropertyDescriptor } from '@typedly/descriptor';
/**
* @description The base abstraction class representing a chain of property descriptors.
* @export
* @abstract
* @class DescriptorChainBase
* @template [O=any] The type of the object that the property descriptors are associated with.
* @template {keyof O} [K=keyof O] The type of the property name in the object.
* @template {K extends keyof O ? O[K] : any} [V=K extends keyof O ? O[K] : any] The type of the value accessed by the property.
* @template {boolean} [A=boolean] The type of active property.
* @template {boolean} [N=boolean] The type of enabled property.
* @template {boolean} [C=boolean] The type of configurable property.
* @template {boolean} [E=boolean] The type of enumerable property.
* @template {WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>} [D=WrappedPropertyDescriptor<O, K, V, A, N, C, E, any>] The type of wrapped property descriptor.
* @extends {DescriptorChainCore<O, K, V, A, N, C, E, D>}
*/
export declare abstract class DescriptorChainBase<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 WrappedPropertyDescriptor<O, K, V, A, N, C, E, D> = WrappedPropertyDescriptor<O, K, V, A, N, C, E, any>> extends DescriptorChainCore<O, K, V, A, N, C, E, D> {
#private;
/**
* @inheritdoc
*/
get active(): A;
/**
* @inheritdoc
*/
get current(): D;
/**
* @inheritdoc
*/
get currentIndex(): number;
/**
* @inheritdoc
*/
protected get data(): D[];
/**
* @inheritdoc
*/
protected get descriptor(): new (object: O, key: K, attributes: WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>) => D;
/**
* @inheritdoc
*/
get enabled(): N;
/**
* @inheritdoc
*/
get key(): K;
/**
* @inheritdoc
*/
get lastIndex(): number;
/**
* @inheritdoc
*/
get nextIndex(): number | undefined;
/**
* @inheritdoc
*/
get object(): O;
/**
* @inheritdoc
*/
get next(): D | undefined;
/**
* @inheritdoc
*/
get previous(): D | undefined;
/**
* @inheritdoc
*/
get previousIndex(): number | undefined;
/**
* @inheritdoc
*/
get size(): number;
/**
* Creates an instance of `DescriptorChainBase` child class.
* @constructor
* @param {O} object The object containing the property.
* @param {K} key The key of the property.
* @param {new (
* object: O,
* key: K,
* attributes: WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>,
* ) => D} descriptor
*/
constructor(object: O, key: K, descriptor: new (object: O, key: K, attributes: WrappedPropertyDescriptor<O, K, V, A, N, C, E, D>) => D);
/**
* @inheritdoc
*/
activate(): this;
/**
* @inheritdoc
*/
clear(): this;
/**
* @inheritdoc
*/
delete(index: number): this;
/**
* @inheritdoc
*/
deactivate(): this;
/**
* @inheritdoc
*/
disable(): this;
/**
* @inheritdoc
*/
enable(): this;
/**
* @inheritdoc
*/
entries(): IterableIterator<[number, D]>;
/**
* @inheritdoc
*/
first(): D;
/**
* @inheritdoc
*/
get(index: number): D;
/**
* @inheritdoc
*/
has(index: number): boolean;
/**
* @inheritdoc
*/
last(): D;
/**
* @inheritdoc
*/
load(): this;
/**
* @inheritdoc
*/
set(index: number, value: D): this;
/**
* @inheritdoc
*/
setCurrentIndex(index: number): this;
/**
* @inheritdoc
*/
update(index: number, value: D): this;
/**
* @inheritdoc
*/
values(): IterableIterator<D>;
}