react-native-tree-multi-select
react-native-tree-multi-select copied to clipboard
[FEAT-REQ] Custom ID type for TreeNode
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 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!
sorry for the delay, but i've opened a pull request @JairajJangle :)
Hey @GamerGirlandCo! 👋
Thanks a lot for your contribution! I’ve reviewed your PR and just merged it into the main branch. 🎉
:tada: This issue has been resolved in version 1.8.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket: