TypeScript Tutorial 11: Function Overloading

preview_player
Показать описание
Learn what function overloading is in typescript and how to make it work with your program.

Рекомендации по теме
Комментарии
Автор

It's actually possible to have more dynamic type arguments. You can actually do side1: number | string.

the_real_minus
Автор

This is why I love (*args, **kwargs) from python. This is making life much easier.
And for this particular example would not be better to pass an object with sides and in the function to check this object and act accordingly?

andreisima
Автор

So that means, we do not have the concept of overriding in typescript, right? I mean, only the function header(areaofQuad) with 1 integer parameter is allowed but not the same function header(areaofQuad) with 1 string parameter? Can you please let me know, if this is correct?

sharanyajidigam
Автор

So, i cant use pseudomass "arguments" in TypeScript? if i dont know how much arguments i will need?

КонстантинГиль-ря
Автор

you missed to add '=' in the else if statement! It should be '===' and not '=='

CatDogMore