Does the implementation need to repeat the effective union type?
Private independently, no. Deprecated independently, yes.
> Does the implementation need to repeat the effective union type?
Yes, or use something even broader like `any`;
A more readable solution I think is to define multiple functions whose names differ by a suffix that indicates argument type.
Arguments with default values are not really "polymorphic". They juts make it possible to call the function with fewer arguments.
And instead of "polymorphic functions" why not use ES6 classes which are polymorphic by their nature. The class of the recipient determines which method gets executed. There too you can use the approach of defining multiple similar methods whose name differs by a suffix indicating their argument-type.
I'm predisposed to agree with you but I would hate looking at code and seeing method signatures like DoThingString(string), DoThingInt(int), etc.
saveInt (i)
saveString(s)
saveBox(box)
saveCat (cat)
And then it might make more sense to define classes Box and Cat and say: box.save()
cat.save()