react-native-tree-multi-select icon indicating copy to clipboard operation
react-native-tree-multi-select copied to clipboard

[FEAT-REQ] Custom ID type for TreeNode

Open GamerGirlandCo opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. I tried changing an existing data type in my project to extend TreeNode. However, since the ID is assumed to be a string, typescript complains.

Describe the solution you'd like Change the TreeNode interface to be generic

export interface TreeNode<T> {
  id: T,
  // ...
}

Describe alternatives you've considered N/A

Screenshots or screen records N/A

Additional context N/A

Would you like to work on this feature? Absolutely!

GamerGirlandCo avatar May 21 '24 22:05 GamerGirlandCo

@GamerGirlandCo Hey there! 👋

Thanks for your feature request and your interest in contributing to the project!

For IDs, I'd suggest using string | number types instead of a more generic template type. These are the most common and practical types for IDs. If you have a specific use case that requires other types, please let me know so we can consider any potential challenges.

So, the TreeNode would look like this:

export interface TreeNode<T extends (string| number)> {
    id: T;
    name: string;
    children?: TreeNode<T>[];
    [key: string]: any;
}

If you'd like to work on this feature and make a PR for it, please ensure all test cases pass and that necessary refactorizations are in place.

Feel free to reach out if you have any questions. Your contribution is much appreciated!

JairajJangle avatar May 23 '24 14:05 JairajJangle

sorry for the delay, but i've opened a pull request @JairajJangle :)

GamerGirlandCo avatar Jan 16 '25 20:01 GamerGirlandCo

Hey @GamerGirlandCo! 👋

Thanks a lot for your contribution! I’ve reviewed your PR and just merged it into the main branch. 🎉

JairajJangle avatar Jan 17 '25 16:01 JairajJangle

:tada: This issue has been resolved in version 1.8.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Jan 17 '25 17:01 github-actions[bot]