QuizIntermediate

Generic Constraints for Property Access

See how constraints enable safe access to a known property on a generic value.

Why does function getId<T extends { id: number }>(x: T) { return x.id; } compile, while an unconstrained version does not?