@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
25 lines (24 loc) • 1.13 kB
TypeScript
import type { PropertyProvider } from '../misc/functions';
/** Property configuration */
export type OverrideDecoratorConfig = {
/** To define readonly property */
readonly?: boolean;
/** To define enumerable property */
enumerable?: boolean;
};
/**
* `@prop` is auxiliary decorator to define a field on the prototype level.
*` @prop` can be used to override decorated property from the parent level
*
* You can also use an @override decorator in combination with ECMA Script class property definition:
* `@prop() public field: any = initial value;`
*
* The class property initial value is a part of object creation, so it goes to the object itself,
* while the @override value is defined on the prototype level.
*
* If the value is a provider function, it will be resolved via instance each time property accessed.
*
* @param value - value or PropertyProvider to set up in prototype
* @param prototypeConfig - prototype property configuration
*/
export declare function prop<T = any>(value?: T | PropertyProvider<T>, prototypeConfig?: OverrideDecoratorConfig): (obj: any, name: string) => any;