Union Vs Intersection in ts
Union - |
Union acts like the unions in Set type:A = {1,2,3}B = {4,5}AUB = {1,2,3,4,5}
So in terms of Typescript:
interface Person {
name: string;
}
interface Lifespan {
birth: Date;
death?: Date;
}
type unionCheck = Person | Lifespan
// Can tak...
tslearnings.hashnode.dev2 min read