...

/

Type Argument Constraints

Type Argument Constraints

This lesson talks about generic type argument constraints.

Overview

Sometimes it makes sense to put some restrictions on type arguments. Having these restrictions allows you to make assumptions about the type argument when referring to it inside some function.

You can express the restriction using the extends keyword. For example, you might decide to enforce the fact that FormField should only contain string, number, or boolean ...

Access this course and 1400+ top-rated courses and projects.