Angular src/app/components/user.components.ts(37,14):错误TS7006:Parameter';i';隐式具有';任何';类型

Angular src/app/components/user.components.ts(37,14):错误TS7006:Parameter';i';隐式具有';任何';类型,angular,Angular,运行我的应用程序时,我遇到以下错误: src/app/components/user.components.ts(33,11):错误TS7006:参数“Hobbi”隐式具有“any”类型。 [0]src/app/components/user.components.ts(37,14):错误TS7006:参数“i”隐式具有“any”类型 这是我的密码: @Component({ moduleId : module.id, selector: 'user', templateUrl: `

运行我的应用程序时,我遇到以下错误:

src/app/components/user.components.ts(33,11):错误TS7006:参数“Hobbi”隐式具有“any”类型。 [0]src/app/components/user.components.ts(37,14):错误TS7006:参数“i”隐式具有“any”类型

这是我的密码:

@Component({
  moduleId : module.id,
  selector: 'user',
  templateUrl: `user.components.html`,
})
export class UserComponent  { 
    name : string;
    email : String;
    address: address;
    hobbies : string[];
    ShowHobbies : boolean;
    constructor(){
        this.name = 'Ratheesh';
        this.email = 'babu.ratheesh@7nodes.com';
        this.address={
            street : 'Near Assisi Lane',
            city: 'Ernakulam',
            country : 'India'
        }
        this.hobbies = ['Reading', 'sports' , 'music']
        this.ShowHobbies = false;
    }
    ToggleHobbies(){
        // console.log('SHow');
        if(this.ShowHobbies == true) {
            this.ShowHobbies = false;
        }else{
            this.ShowHobbies = true;
        }
    }
    addHobby(Hobbi){
        this.hobbies.push(Hobbi);

    }
    deleteHobby(i){
        this.hobbies.splice(i, 1);

    }

}

interface address {
    street : string;
    city: string;
    country :string;
}

您需要将类型作为
任何
传递

 addHobby(Hobbi:any){
        this.hobbies.push(Hobbi);
 }

您需要将类型作为
任何
传递

 addHobby(Hobbi:any){
        this.hobbies.push(Hobbi);
 }