Function and Inference Variables

This lesson goes over functions and inference variables.

TypeScript can infer the type of a variable, hence, it is possible to avoid using the colon for anonymous functions by simply setting the variable to an unnamed function that has type parameters and a return type. In the example below, all the myAnonymous… functions (lines 5, 8, 11, 12) have no type defined but they are all strongly typed by inference.

Get hands-on with 1200+ tech skills courses.