Typescript Get Type From Function Python Questions On While Loop