Typescript Extract Type From Array Python Example Code