Typescript Type In Array Javascript Iteration