Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: relationshipsToOmit bug when terminateCircularRelationships is true #78

Merged
merged 2 commits into from
Mar 21, 2022

Conversation

ardeois
Copy link
Owner

@ardeois ardeois commented Mar 21, 2022

export type A = {
    B: B;
    C: C;
};
export type B = {
    A: A;
};
export type C = {
    aCollection: A[];
};

export type D = {
    A: A;
    B: B;
};

In this situation, Type B in Type D should return object A once, not an empty object.

But now, in the process of creating type D, Type A is created first, and after calling Type B inside Type A, Type B inside Type D is recognized as the second call.

This appears to be a side effect, not the originally intended recursion prevention effect, in my opinion.

So I modified the recursive call prevention logic by converting the set object to an array with immutability.

This PR is a followup of #77

@ardeois ardeois self-assigned this Mar 21, 2022
@ardeois ardeois added the minor Increment the minor version when merged label Mar 21, 2022
@ardeois ardeois enabled auto-merge (squash) March 21, 2022 13:22
@ardeois ardeois merged commit 150b4c7 into main Mar 21, 2022
@ardeois ardeois deleted the feat/circular-relationships-reference-error branch March 21, 2022 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants