typestack / class-transformer

Decorator-based transformation, serialization, and deserialization between objects and classes.
MIT License
6.66k stars 487 forks source link

feat: resolve & convert `circular dependent Js plain object` to `Js class instance` #1625

Closed Norlandz closed 4 months ago

Norlandz commented 9 months ago

Description

src\CircularDependencyLinkageManager.ts

@|important @|main

the main file for adding functionality \ to resolve & convert circular dependent Js plain object to Js class instance \ (-- ResolveCircularDependenyWhenPlainToClass) \ (only works in simple case)

src\TransformOperationExecutor.ts

@|important

modified to use src\CircularDependencyLinkageManager.ts

test\functional\ResolveCircularDependenyWhenPlainToClass.spec.ts

@|important

test/demo file for src\CircularDependencyLinkageManager.ts

@|WARN:: \ for ResolveCircularDependenyWhenPlainToClass.spec.ts \ You MUST Run this Test file with "emitDecoratorMetadata": false

related: #1622

src\interfaces\class-transformer-options.interface.ts src\constants\default-options.constant.ts

add the option for src\CircularDependencyLinkageManager.ts

tsconfig.json \ tsconfig.spec.json \ jest.config.js

@|not_important @|messy @|tweaks

tweak tsconfig.json so that vscode can recognize the test files & debug/run the Jest test file

package.json \ pnpm-lock.yaml

@|not_important

need upgrade jest, otherwise the bomb array test fail dk why

.vscode\launch.json

@|not_important

use tsx to run ts file

Checklist

Fixes

fixes #224 (though the OP claimed the issue was fixed, was not for my case.)

Problems facing

Code should run with no problem. \ But, Following needs to be fixed.

github-actions[bot] commented 3 months ago

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.