Home > Software design >  Parameter 'day' implicitly has an 'any' type.ts(7006)
Parameter 'day' implicitly has an 'any' type.ts(7006)

Time:02-21

I have this class file in angular weather.ts and I have received an error Parameter 'day' implicitly has an 'any' type.ts(7006), which also applied to the data I instantiated (temperature, windspeed, event). Below is the code.

weather.ts

 export class Weather
    {
        day:string;
        temperature:string;
        windspeed:string;
        event:string;
    
    
        constructor(day, temperature, windspeed, event)//this is where the error occured
        {
            this.day = day;
            this.temperature = temperature;
            this.windspeed = windspeed;
            this.event = event;
        }
    
    }

CodePudding user response:

u must configure your constructor params (set type to each property) like below:

constructor(day: string, temperature: string, windspeed: string, event: string)
  • Related