@microsoft/decorators package

A conservative set of decorators intended for use in both NodeJS and web browser projects.

Functions

override(target, propertyKey, descriptor)

This decorator is applied to a class's member function or property. It indicates that the definition overrides another definition (of the same name) from the base class. The base class definition must be marked as @virtual. This decorator is currently used for documentation purposes only. In the future, it may be enforced at runtime.

sealed(target)

This decorator is applied to a class (but NOT member function or property). It indicates that subclasses must not inherit from this class. This decorator is currently used for documentation purposes only. In the future, it may be enforced at runtime.

virtual(target, propertyKey, descriptor)

This decorator is applied to a class's member function or property. It indicates that the definition may optionally be overridden in a child class. Conversely, if the @virtual decorator is NOT applied to a definition, then child classes may NOT override it. This decorator is currently used for documentation purposes only. In the future, it may be enforced at runtime.

Function Details

override(target, propertyKey, descriptor)

This decorator is applied to a class's member function or property. It indicates that the definition overrides another definition (of the same name) from the base class. The base class definition must be marked as @virtual. This decorator is currently used for documentation purposes only. In the future, it may be enforced at runtime.

export declare function override(target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>): void;

Parameters

target

object

propertyKey

string | symbol

descriptor

TypedPropertyDescriptor<any>

Returns

void

sealed(target)

This decorator is applied to a class (but NOT member function or property). It indicates that subclasses must not inherit from this class. This decorator is currently used for documentation purposes only. In the future, it may be enforced at runtime.

export declare function sealed(target: Function): void;

Parameters

target

Function

Returns

void

virtual(target, propertyKey, descriptor)

This decorator is applied to a class's member function or property. It indicates that the definition may optionally be overridden in a child class. Conversely, if the @virtual decorator is NOT applied to a definition, then child classes may NOT override it. This decorator is currently used for documentation purposes only. In the future, it may be enforced at runtime.

export declare function virtual(target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>): void;

Parameters

target

object

propertyKey

string | symbol

descriptor

TypedPropertyDescriptor<any>

Returns

void