Typescript Dynamic Key Value Javascript Array Slice Method In Js