#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

Popular posts from this blog

#6 Objects (Fundamentals of TS)

#8 Union Type (Advanced Types)