How to define optional constructor arguments with defaults in Typescript?

Posted by Rohit Kumar | Updated on

Want to define optional constructor arguments with defaults in Typescript? Default-initialized parameters that come after all required parameters are treated as optional, and just like optional parameters, can be omitted when calling their respective function. It’s the same for constructors as it is for other functions, so in your case:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers