@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
21 lines (20 loc) • 1.11 kB
TypeScript
import type { ValueOrProvider } from '../misc/functions';
/** Property configuration */
export type OverrideDecoratorConfig = {
/** To define readonly property */
readonly?: boolean;
/** To define enumerable property */
enumerable?: boolean;
};
/**
* `@prop` decorator: defines a prototype-level property (value or computed via provider) with optional flags.
* - Static value: defined on prototype (writable unless `readonly`)
* - Provider function: installed as getter; each access invokes provider with `(this)`; optional setter creates own value
* - Readonly: setter becomes no-op (provider case) or value made non-writable (static case)
* - Enumerable flag passed through
* - Throws if attempting to decorate an already own property on the prototype object
*
* @param value - static value or provider function producing the value per access
* @param prototypeConfig - configuration object with optional `readonly` and `enumerable` flags
*/
export declare function prop<T = any>(value?: ValueOrProvider<T>, prototypeConfig?: OverrideDecoratorConfig): (obj: any, name: string) => any;