Typescript Count Array Javascript Length Validation