intersection type are create a new type by extending exciting types using
& operator
interface type1{...}
interface type2{...}
type type3 = type1 & type2
using & works same way as using extends clause with only difference being
in way they resole conflicts
//these are two interfaces with same property but with incompatible types
interface type1{
property:string
}
interface type2{
property:number
}
type3 = type1 & type2
type3 will result in never type because
TypeScript will try to combine the types regardless
interface type2 extends type1{
property:number
}
here typescript will throw an error because the types are incompatible