Currently, I am including a middleware into a module.
Encountering a type error while invoking consumer.apply(middleware)
:
Snippet of Code:
@Module({
...
})
export class FooModule implements NestModule {
@Inject(FOO_MIDDLEWARE)
private middleware: NestMiddleware;
public configure(consumer: MiddlewareConsumer) {
consumer
.apply(this.middleware)
.forRoutes('foo');
}
}
Error Message:
TS2345: Argument 'NestMiddleware<any, any>' cannot be assigned to parameter 'Function | Type<any>'. The properties apply, call, bind, prototype, and few others are missing in type 'NestMiddleware<any, any>' compared to 'Type<any>'.