Let's learn how to use the OOP, Constructor Parameter Properties in your TypeScript class (known as TypeScript Constructor Shorthand or Constructor Property Promotion in PHP 8).
Using the Parameter Properties in your TypeScript projects will make your code cleaner, more readable and more concise. This constructor shorthand turns a class constructor parameter into a class property with the same name / value.
References:
- Parameter Properties - https://www.typescriptlang.org/docs/handbook/2/classes.html#parameter-properties
- Constructor Property Promotion - https://dev.to/pierre/constructor-property-promotion-2dek
Happy TypeScript Developing Day! 🤠
You can check out my projects on GitHub at GitHub.com/pH-7 ⚡️
Was this helpful? Would you offer me one of my favorite cups of coffee? https://ko-fi.com/phenry ☕️
You might also be interested in reading:
Happy debugging! 🤠 Enjoy solving problems! 🎯
Top comments (0)