0

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;
    }
}
Leonardo
  • 2,439
  • 33
  • 17
  • 31
Xon Version4
  • 65
  • 1
  • 6
  • Does this answer your question? [Error when trying to inject a service into an angular component "EXCEPTION: Can't resolve all parameters for component", why?](https://stackoverflow.com/questions/37997824/error-when-trying-to-inject-a-service-into-an-angular-component-exception-can) – Ismael Vacco Feb 24 '22 at 00:02

1 Answers1

0

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

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