Merging Interfaces in Typescript

The simplest, and perhaps most common, type of declaration merging is interface merging. At the most basic level, the merge mechanically joins the members of both declarations into a single interface with the same name.

interface Box {
height: num…


This content originally appeared on DEV Community and was authored by es404020

The simplest, and perhaps most common, type of declaration merging is interface merging. At the most basic level, the merge mechanically joins the members of both declarations into a single interface with the same name.

interface Box {
  height: number;
  width: number;
}
interface Box {
  scale: number;
}
let box: Box = { height: 5, width: 6, scale: 10 };



This content originally appeared on DEV Community and was authored by es404020


Print Share Comment Cite Upload Translate Updates
APA

es404020 | Sciencx (2021-09-08T21:09:27+00:00) Merging Interfaces in Typescript. Retrieved from https://www.scien.cx/2021/09/08/merging-interfaces-in-typescript/

MLA
" » Merging Interfaces in Typescript." es404020 | Sciencx - Wednesday September 8, 2021, https://www.scien.cx/2021/09/08/merging-interfaces-in-typescript/
HARVARD
es404020 | Sciencx Wednesday September 8, 2021 » Merging Interfaces in Typescript., viewed ,<https://www.scien.cx/2021/09/08/merging-interfaces-in-typescript/>
VANCOUVER
es404020 | Sciencx - » Merging Interfaces in Typescript. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/09/08/merging-interfaces-in-typescript/
CHICAGO
" » Merging Interfaces in Typescript." es404020 | Sciencx - Accessed . https://www.scien.cx/2021/09/08/merging-interfaces-in-typescript/
IEEE
" » Merging Interfaces in Typescript." es404020 | Sciencx [Online]. Available: https://www.scien.cx/2021/09/08/merging-interfaces-in-typescript/. [Accessed: ]
rf:citation
» Merging Interfaces in Typescript | es404020 | Sciencx | https://www.scien.cx/2021/09/08/merging-interfaces-in-typescript/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.