-
Notifications
You must be signed in to change notification settings - Fork 199
Fixes CellArray related warnings. #96 #101
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
Conversation
|
I originally added the CellArray class to consolidate those methods into one place and make it so that operations involving multiple cells would be performed on the object itself. I didn't like having Generally I've have tried to avoid adding methods to prototypes because of the side effects e.g. when going let o = [];
Array.prototype.foo = function() {}
for (let k in o) {console.log(k);} // -> outputs `foo`will output I'm wondering whether it might be an idea to move those methods into a utility object e.g. |
|
Yeah, I agree it's an anti-pattern. I thought about hiding the methods with As @mcyph mentioned, I think moving the methods to utility functions is a better idea. These methods are not used that frequently, so migration wouldn't be too overwhelming. |
|
Hi guys, I am also ok to move the methods to utility functions. |
|
I've created a file named |
Summary
CellArraywas a wrapper(by extendingArray) forCell[]which provided additional methods such asfilterCells(). However, it had conflicting signatures compared to the normal array that resulted in TypeScript warnings which were hard to avoid.So instead, I removed the
CellArrayclass, and addedfilterCells()methods into theArrayprototype. This way, migrating to maxGraph is easier, since it is no longer necessary to convert[cell]tonew CellArray(cell).Description for the changelog
Fixes CellArray related warnings. #96
Other info
In #96, there's one more type of warning regarding
GraphLayout'straverse()method. Currently,HierarchicalLayoutandSwimlaneLayoutboth inherit from that method, but with different signatures. It is not possible to fix them easily, so I'll leave it as is.