在下一个主要版本中,Nest 将不允许使用 @Injectable()、@Catch() 和 @Controller() 装饰器注释的类

Dan*_*nik 5 javascript dependency-injection typescript nestjs

我在 Nest.js 框架中编写了 3 年,我通过后端应用程序收到了消息:

WARN [DependenciesScanner] In the next major version, Nest will not allow classes annotated with @Injectable(), @Catch(), and @Controller() decorators to appear in the "imports" array of a module.
Please remove "ExternalOrAdmin" (including forwarded occurrences, if any) from all of the "imports" arrays.

Scope [BackendAdminModule -> LicenseModule -> AuthModule]
Run Code Online (Sandbox Code Playgroud)

我研究了 Nest.js github,并发现问题是什么以及为什么它说一些可用装饰器的弃用。

有谁知道如何解决这个问题或者 Nest.js 框架的下一个主要版本将会有什么

提前致谢!

Mic*_*evi 13

数组中只应列出模块imports。这就是为什么在 v9 中不再允许这种错误的用法。

阅读有关模块的文档:https://docs.nestjs.com/modules