TypeScript · Middle · Question 34 of 75

Why is interface preferable to an intersection for extending large object types?

Explanation

With interface B extends A, a property conflict is an error at the declaration, while an intersection silently produces never. The compiler caches interface relationships, so it's faster in large codebases - as the TS performance wiki recommends.

Further reading

Problem with a question

TypeScript · Middle · question 34

Test yourself

Take the TypeScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz