export interface User {
    name: string;
    age?: number; //? no required
    id: number;
    email: string;
}

// let user: User = {name: "John Doe", id: 1, email: ""};

// Destructuring: phân rã đối tượng
let { name: userName, email: userLogin }: User = { name: "John Doe", id: 1, email: "" };

interface Employees extends User {
    salary: number;
}

let employee: Employees = {
    name: "Jane Smith",
    id: 2,
    email: "",
    salary: 50000
};
//export: cho phép sử dụng interface này ở file khác
export interface Login {
    login(): User;
}

let [user1, user2, ...restUser]: User[] = [
    { name: "John Doe", id: 1, email: "" }, 
    { name: "Jane Smith", id: 2, email: "" }, 
    { name: "Alice Johnson", id: 3, email: "" },
    { name: "Bob Brown", id: 4, email: "" }
];
console.log(user1);
console.log(user2);
console.log(restUser);

let rs = restUser.filter((user) => user.id > 3);
console.log(rs);

//decorator
// @Component({})
// class Component {
//     constructor(public name: string){}
// }