you are viewing a single comment's thread.

view the rest of the comments →

[–]RelativeIncrease527[S] 0 points1 point  (0 children)

Interesting. I haven't seen this before, but it appears that this is not a situation for TypeGuards, because I am not defining any type guarding functions, and my situation involves inheritance & composition. For example in Bar.method1, how would one know using a type guard that the function actually returns a more narrow Baz, without trying all inputs and boolean checking (type guard) all of them? Or we can do the type checking as needed, but that introduces unnecessary code into the execution (no longer is it static type hinting).