Typescript Loop Through Array With Index