/** Decorator is a structural design pattern that attaches
 * new behaviors to objects by placing these objects inside
 * special wrapper objects that contain the behaviors.
 */ interface Component { operation ( ) : string ; } export class ConcreteComponent implements Component { public operation ( ) { return 'ConcreteComponent' ; } } class Decorator implements Component { protected component : Component ; constructor ( component ) { this . component = component ; } public operation ( ) { return this . component . operation ( ) ; } } export class ConcreteDecoratorA extends Decorator { public operation ( ) { return `ConcreteDecoratorA(${ super . operation ( ) })` ; } } export class ConcreteDecoratorB extends Decorator { public operation ( ) { return `ConcreteDecoratorB(${ super . operation ( ) })` ; } }