webstorm bugs using NestJs LoggerMiddleware
I'm trying to configure the NestJs Logger class, but the IDE throws me this errors:
- Unresolved function or method get()
- Unresolved function or method on()
- Method expression is not of Function type
I've already have installed the @types/express but the errors are still there.
The project seems to run and work fine, how can I fix these bugs or what am I missing to configure or installl inside the project?
Thanks

请先登录再写评论。
Can't reproduce with
Could you share a code snippet (as text) or a sample project that reproduces the issue?
Hi, sure, here's the code snippet:
By the way, I'm using the latest version of WebStorm
import { Injectable, Logger, NestMiddleware } from '@nestjs/common';
import { NextFunction, Request, Response } from 'express';
@Injectable()
export class LoggerMiddleware implements NestMiddleware {
private logger: Logger = new Logger('HTTP');
use(req: Request, res: Response, next: NextFunction): void {
const { method, originalUrl } = req;
res.on('finish', () => {
const { statusCode } = res;
this.logger.log(`${method} [${statusCode}] - ${originalUrl}`);
});
next();
}
}
Thanks! Works fine for me when using your snippet (the latest Webstorm version):
Could you check if you can reproduce the issue in a new project?
I reproduced the exact same code on a different project using the webstorm's NestJs template and the issue didn't appear.
Do you have any idea of why this could have happen?
Mare sure that the
node_modulesfolder is included in index. If this doesn't help, it must be a problem with project dependencies (there might be some conflicts)