I have set "noImplicitAny" to true in tsconfig.json. I am getting this error, Error TS7006: Parameter 'req' implicitly has an 'any' type.
One way to solve this is to explicitly mention any to all req parameters. I looked up for other solutions in stackoverflow but most of them suggested to just mark "strict" as false or "noImplicitAny" to false. But I want to implement "noImplicitAny".
Is there any other method which will suppress this error. Thanks
"noImplicitAny" means you can't have anything that defaults to any. Which means typescript can't infer the type. If you want to use "noImplicitAny" you need the types.
As Nest is built on ExpressJS, you may use the Request type that comes with Express.
import { Request } from express
findAll(@Req() request: Request): string {
return 'This action returns all cats';
}
The only other way to suppress the error is to smack a "any" on it, but that kind of defeats the purpose of using typescript.