There is type inference in TypeScript. Consider the following:
Just as TypeScript can infer types of variables, it can do so for arguments and return values:
Arrays of Types
Consider:
TypeScript has a “best type” algorithm that is used when it encounters an array of multiple types (or single types). For instance, the array above would be of type numbers[]. Consider the following: