Skip to content

Commit 1c0e18e

Browse files
Merge pull request #2803 from CHFR-wide/swc-circular-deps-precision
docs(swc): Adds precision on managing nest circular deps
2 parents 18258e7 + d3a844f commit 1c0e18e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

content/recipes/swc.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,18 @@ If your ORM does not provide a similar workaround, you can define the wrapper ty
192192
export type WrapperType<T> = T; // WrapperType === Relation
193193
```
194194

195+
For all [circular dependency injections](/fundamentals/circular-dependency) in your project, you will also need to use the custom wrapper type described above:
196+
197+
```typescript
198+
@Injectable()
199+
export class UserService {
200+
constructor(
201+
@Inject(forwardRef(() => ProfileService))
202+
private readonly profileService: WrapperType<ProfileService>,
203+
) {};
204+
}
205+
```
206+
195207
### Jest + SWC
196208

197209
To use SWC with Jest, you need to install the following packages:

0 commit comments

Comments
 (0)