#9 Intersection Type (Advanced Types)
It is used where there is a constant which is of two or more types. It is denoted by &. It can be written as;
type work={()=>void}
type worker={()=>console.log("hi")}
const office:{work & woker}={
work:()=>{},
worker:()=>{}
}
In this way, we can use both the types at the same object constant by using &
Comments
Post a Comment