TypeScript tutorialLesson 34Free preview
TS Declaration Merging
This lesson is part of TypeScript · All levels
Summary
Declaration merging occurs when two declarations of the same name combine the compiler into one definition. Two interfaces with the same name will merge, while two alias types with the same name will cause error. This pattern is also used for overloading and completing class declarations.
Key points
- Two interfaces are the same.
- Type alias must not be duplicated
- Overload is a form of merging on functions
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.