Skip to content

Conversation

@raswonders
Copy link

@raswonders raswonders commented Jan 12, 2026

useDataViewSelection provides nice API for a table selection but it's lacking in type inference department. Returned value from this hook is filled with "any".

image

For type safety we currently assert over these values but it would be nicer if we din't have to. This is just a Quality of Life improvement and we can still use type assertion to work around it but it would feel little nicer if we didn't have to assert it over and either use:
explicit generic type argument useDataViewSelection<DataViewTrObject> or get it inferred from initialSelected param.

This PR implementing both use cases but just either one of them would be fine. It also falls back to "any" in case generic argument isn't provided or type cannot be inferred from initialSelected value.

What do you think, would you be interested in solution like this?

@patternfly-build
Copy link

patternfly-build commented Jan 12, 2026

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