Decorator Pattern in TypeScript

The decorator pattern is a structural pattern, that allows you to attach additional responsibilities to an object at runtime.

The decorator pattern is used in both the Object Oriented and Functional paradigms.

The decorator pattern adds extensibility without modifying the original object.

The decorator forwards requests to the enclosed object and can perform extra actions.

You can nest decorators recursively.

Terminology

  • Component Interface

--

--

--

A Design Pattern is a description or template that can be repeatedly applied to a commonly recurring problem in software design. A familiarity of Design Patterns is very useful when planning, discussing, managing and documenting your applications from now on and into the future.

Recommended from Medium

The Top 3 React UI Libraries for Beginners

Laptop

What Is Selenium Framework | Limitation | 9 Key Points — Pure Coders

Mapping out managerial social networks in shipping industry

How I solved `xlink:href ` issue in IE11 without using svgx polyfill

Internship Reflection #3 / General Takeaways

Classes in JavaScript

Dockerize and run angular Application in an efficient way

Sum a range of numbers/javascript

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sean Bradley

Sean Bradley

Developer of real time, low latency, high availability, asynchronous, multi threaded, remotely managed, fully automated and monitored solutions.

More from Medium

Script Of Typescript

What’s New in TypeScript 4.6?

Type Safe and Exhaustive ‘switch’ statements, aka Pattern Matching in TypeScript

TypeScript Type Gymnastics: Array lengths implement numerical operations