更新时间:2022-12-06 11:57:50
使用forwardRef()
只是您的最后选择.或者,考虑将模块之一分成两个或多个部分,以打破循环依赖关系,例如:
Working with forwardRef()
should only be your last resort. Alternatively, consider splitting one of the modules into two or more parts to break the circular dependencies, e.g.:
AuthModule
进入
AuthLoginModule
被UserModule导入ValidateAuthModule
导入UserModule AuthLoginModule
gets imported by the UserModuleValidateAuthModule
imports the UserModule或UserModule
分为两部分.