Skip to content

Conversation

@Jonghakseo
Copy link
Contributor

@Jonghakseo Jonghakseo commented Mar 19, 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.

@ardeois
This library is very useful for testing in my project and I want this fix to be implemented quickly. thank you 👍🏼

@Jonghakseo Jonghakseo changed the title fix: type generating bug when terminateCircularRelationships is true fix: bug when terminateCircularRelationships is true Mar 19, 2022
@Jonghakseo Jonghakseo changed the title fix: bug when terminateCircularRelationships is true fix: relationshipsToOmit bug when terminateCircularRelationships is true Mar 19, 2022
@ardeois ardeois changed the base branch from main to feat/circular-relationships-reference-error March 21, 2022 13:16
@ardeois ardeois self-assigned this Mar 21, 2022
Copy link
Owner

@ardeois ardeois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the contribution

@ardeois ardeois added the minor Increment the minor version when merged label Mar 21, 2022
@ardeois ardeois merged commit ca84ca7 into ardeois:feat/circular-relationships-reference-error Mar 21, 2022
@Jonghakseo Jonghakseo deleted the fix/circular-relationships-reference-error branch March 22, 2022 05:48
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