Skip to content

fix: add types to useSuspenseSelect#60733

Merged
jsnajdr merged 3 commits intoWordPress:trunkfrom
johnhooks:fix/add-types-use-suspense-select
Apr 15, 2024
Merged

fix: add types to useSuspenseSelect#60733
jsnajdr merged 3 commits intoWordPress:trunkfrom
johnhooks:fix/add-types-use-suspense-select

Conversation

@johnhooks
Copy link
Copy Markdown
Contributor

What?

This PR improves the types of the useSuspenseSelect hook.

Why?

The current typing of useSuspenseSelect is very basic, and does not use the existing types of useSelect. By using them we can provided better information about the returned data.

How?

Using a generic MapSelect type for the argument and it's return type provide exact typings of the provided select function when using a typed data store object.

This commit use existing types to more completely type the `useSuspenseSelect` hook.
Using a generic `MapSelect` type for the argument and it's return type will provide
exact typings of the provided `select` function when using a typed data store object.
@johnhooks johnhooks requested a review from nerrad as a code owner April 14, 2024 14:50
@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: johnhooks <bitmachina@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka requested review from jsnajdr and tyxla April 15, 2024 04:49
@jsnajdr jsnajdr added [Type] Enhancement A suggestion for improvement. [Package] Data /packages/data labels Apr 15, 2024
Copy link
Copy Markdown
Member

@jsnajdr jsnajdr left a comment

Choose a reason for hiding this comment

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

Yes, this is nice. Thank you!

@jsnajdr jsnajdr merged commit c53c910 into WordPress:trunk Apr 15, 2024
@github-actions github-actions bot added this to the Gutenberg 18.2 milestone Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Data /packages/data [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants