Closed superpupervlad closed 2 years ago
your interceptor should have this constructor:
constructor(
@Optional() private first_optional_param?: string,
@Optional() private second_optional_param: string = 'abc',
) {}
learn here: https://docs.nestjs.com/providers#optional-providers
Is there an existing issue for this?
Current behavior
@UseInterceptors
can't handle interceptor (with optional parameters) that passed as type.Minimum reproduction code
https://stackblitz.com/edit/nestjs-typescript-starter-bnqkzn?file=src/app.controller.ts
Steps to reproduce
No response
Expected behavior
Due to documentation (
leaving responsibility for instantiation to the framework and enabling dependency injection
) nest should create an instance of interceptor because no parameters needed from user and it is possible to create interceptor.Package
Other package
No response
NestJS version
8.1.1
Packages versions
From stackblitz
Node.js version
16.14.2
In which operating systems have you tested?
Other
No response