DEV Community

Cover image for Typescript method overloading
kreuzerk
kreuzerk

Posted on

Typescript method overloading

Method overloading is a familiar concept from traditional programming languages like Java or C#. It basically allows a class to have multiple methods with the same name if their signature is different.

But Typescript only helps us during edit and compile time and not at runtime. Therefore method overloading works different. The executed code is still pure Javascript.

Due to the dynamic nature of JavaScript we can’t use overloading in the same way we do in other languages. Find out how method overloading works in TypeScript

Top comments (3)

Collapse
 
equiman profile image
Camilo Martinez • Edited

Did you know that on dev.to there is an option to automatically import your post from medium? And can use canonical url without affecting SEO rank?

Collapse
 
kreuzerk profile image
kreuzerk

Hi Camilo Martinez. No, I am new to dev.to and did not know about this feature. How can I enable it?

Collapse
 
equiman profile image
Camilo Martinez