属性 类型 Employee 中缺少 toggleEdit,但它是一种方法,怎么办?Angular2

Property toggleEdit is missing in type Employee", but it is a method, what to do? Angular2

我有一个员工组件 -

export class EmployeeComponent{
name:string;
    isEditOn:boolean;

    constructor(){}

     toggleEdit():void{
        this.isEditOn = !this.isEditOn;
    }
}

而 EmployeeList 组件是这样的 -

export class EmployeeListComponent{
    employees: Employee[] = [];

    AddNewEmployee(){
        this.employees.push({name:"New Employee", isEditOn:false});
    }
}

我在尝试将新员工推送到列表中时遇到错误。

Property 'toggleEdit' is missing in type '{ name: string; isEditOn: false; }'.

但这不就是一种方法吗?我在这里遗漏了什么吗?

export class Employee {

    constructor(public name: string, public isEditOn: boolean){}

     toggleEdit():void{
        this.isEditOn = !this.isEditOn;
    }
}

export class EmployeeListComponent{
    employees: Employee[] = [];

    AddNewEmployee(){
        this.employees.push(new Employee("New Employee", false));
    }
}