8000 docs: add jsdoc to make it clear that ArrayCollection.add() is idempotent by alcalyn · Pull Request #6292 · mikro-orm/mikro-orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

docs: add jsdoc to make it clear that ArrayCollection.add() is idempotent #6292

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alcalyn
Copy link
@alcalyn alcalyn commented Dec 11, 2024

Just starting with MikroOrm.

I found some places where there is no jsdoc not documentation, e.g for those two methods, I had to check source code to know if I need to do if (collection.contains()) before adding an item or not.

Copy link
Member
@B4nan B4nan left a comment

Choose a reason for hiding this comment

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

I believe you will also need to add @inheritDoc on the Collection methods that override those.

Also I am not so sure about your comments there, I would rather describe the purpose of those methods, not their implementation details. e.g. its not about add method being idempotent, the Collection cannot hold duplicates, the fact that we do the contains check is just an implementation detail, it would work the same without it, since the items are stored in a Set internally.

@@ -159,6 +159,9 @@ export class Collection<T extends object, O extends object = object> extends Arr
return super.toJSON() as unknown as EntityDTO<TT>[];
}

/**
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be over the set method too. Ideally on all the collection methods that are overriding the arraycollection ones.

Copy link
Author

Choose a reason for hiding this comment

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

set seems not to be overriden in Collection.

Sorry I take time to respond because I was confused, and I'm currently replacing typeorm by mikro-orm, and I want to make sure I understand mikro-orm before adding jsdoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0