typescript check if instance implements interface