Typescript Get Type From Function In Python Syntax If Else Statement