When dealing with heterogeneous arrays in TypeScript, I frequently want to use list.filter(...) to extract an array of all one type. However without extra effort, TypeScript will implicitly type the result of that filtering the same as the input. For example: Notice how numbers and strings are still considered…