This is a dumb question but I have a function that does:
export function parseSomething(someList: string[]): string[] {
someList.forEach((someField: string) => {
console.log(typeof someField)
})
someField is being read as an object. Why? The object being passed to this function is a string array.
The typeof operator returns a string indicating the type of the unevaluated operand. It does work on execution time, so there is no TypeScript at this point. And there is no array type in JavaScript, as arrays are objects. You can read on mdn for more about JavaScript types.
Arrays exist only while writing code with your linter and on compilation time with your compilator as it's a TypeScript only type. You can use Array.isArray() to test if someField is an array on execution time, like so as an example:
console.log(Array.isArray(someField))