Sets a value on a class' prototype
MIT License
A decorator for setting a property on the class prototype (previously known as typescript-proto-decorator).
/**
* Sets a value on the class' prototype
* @param value The value to set
* @param options Options to set. Defaults to configurable, enumerable and writable.
*/
function Proto(value: any, options?: Pick<PropertyDescriptor, 'configurable' | 'enumerable' | 'writable'>): PropertyDecorator;
import {Proto} from 'proto-decorator';
class MyClass {
// set MyClass.prototype.foo = 'bar'
@Proto('bar')
public foo: string;
// set MyClass.prototype.count = 1; It will be non-enumerable, non-writable.
@Proto(1, {writable: false, enumerable: false})
public readonly count: number;
}
@Proto.immutable
as a shortcut for {configurable: false, enumerable: true, writable: false}
.@Proto.hidden
as a shortcut for {configurable: true, enumerable: false, writable: true}
.@Proto.immutableHidden
as a shortcut for {configurable: false, enumerable: false, writable: false}
.The UMD global name is ProtoDecorator
.