...

/

On How TypeScript Handles Variance

On How TypeScript Handles Variance

This lesson gives the theory of how TypeScript handles variance.

Type system variances

TypeScript variances use the nomenclature of another language, which is confusing by nature. It’s not something you must master since the compiler will stop you from doing anything crazy.

However, it’s good to understand before having the compiler manage the complexity for us. Before getting started, let’s create some interfaces to examine how TypeScript handles (or doesn’t handle) covariant, contravariant, bivariant, ...