Intermediate TypeScript
Q61 / 100

How do generic constraints work, e.g. "function logLength<T extends { length: number }>(arg: T)"?

Correct! Well done.

Incorrect.

The correct answer is B) They restrict T to types that have at least a "length" property of type number

B

Correct Answer

They restrict T to types that have at least a "length" property of type number

Explanation

The "extends" clause in a generic constraint limits which types can be passed in, ensuring they have the required shape.

Progress
61/100