Languages
[Edit]
EN

TypeScript - function overloading

8 points
Created by:
Palus-Bear
1016

In this article, we would like to show how to overload function in TypeScript.

TypeScript supports function overloading syntax that lets to deflate multiple functions with the same name, different arguments and return types. It is required just to provide some functions declarations and one function definition.

Note: go to this article to know how to overload method in class.

Quick solution:

 

Practical example

Edit

Output:

 

See also

Edit
  1. TypeScript - class methods overloading

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join