Typescript Get First Element Of Array Safely Cleaning