Intersection

Intersection types are another powerfull feature in typescript ,It allow us to combine mupltiple types into one type.
                  
                    type Person = {
                      name: string;
                      age: number;
                      city: string;
                      state: string;
                      isHavingDrivingLicense: boolean;
                    };

                    type Employee = {
                      emp_id: string;
                      job_role: string;
                      department: string;
                    };

                    type EmployeeDetails = Person | Employee; // using union==============================
                    type EmployeeData = Person & Employee; // using intersection=======================

                    const employee: EmployeeData = {
                      name: 'I am bakwas developer, Any compnay does not want to hire me',
                      age: 36,
                      city: 'kanpur',
                      state: 'UP',
                      isHavingDrivingLicense: true,
                      emp_id: 'EMP123',
                      job_role: 'Jadhu lagana',
                      department: 'Cleaning and Wshing',
                    };

                    // console.log(employee);

                    type UserData = {
                      name: string;
                      age: number;
                      mobile: number;
                    };

                    type UserLocation = {
                      street: string;
                      city: string;
                      state: string;
                    };

                    const userInfo: UserData = { name: 'I am Saten', age: 36, mobile: 998999888 };
                    const userLocation: UserLocation = {
                      street: 'Kailas nagar',
                      city: 'Kanpur',
                      state: 'UP',
                    };
                    ``;

                    const showUserProfile = (user: UserData, location: UserLocation) => {
                      const fullData = { ...user, ...location };
                      return fullData;
                    };

                    const fullData: UserData & UserLocation = showUserProfile(
                      userInfo,
                      userLocation
                    );
                    // console.log(fullData);