Typescript Array.length Not Working