getElementTypeOfArrayType(t) === numberTypegetElementTypeOfArrayType returns undefined if t is not an array type.
Use isArrayType or isArrayLikeType if that's all you need to know.
Probably you return undefined instead of a new or existin node, but look at src/compiler/transformers/ts.ts.
Deleting type annotations is its main job.