Skip to content
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

Improve ResponsePickerApi type #2536

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from

Conversation

snamoah
Copy link

@snamoah snamoah commented Dec 17, 2024

Background

Currently ResourcePickerApi is incorrectly returning SelectPayload<'product' | 'variant' | 'collection'> type even when type: 'product' is passed to the resourcePIcker. See screenshot below showing before and after

Solution

Add generic constraints to ResourcePickerApi function type so that the return type is based on the type option passed as parameter.

Before

IMG_4227

After

IMG_4226

🎩

  • ...

Checklist

  • I have 🎩'd these changes
  • I have updated relevant documentation

@olavoasantos olavoasantos requested a review from a team December 17, 2024 19:25
@snamoah snamoah marked this pull request as ready for review December 17, 2024 22:11
Copy link
Contributor

We detected some changes in packages/*/package.json or packages/*/src, and there are no updates in the .changeset directory. If the changes are user-facing and should cause a version bump, run yarn changeset to track your changes and include them in the next release CHANGELOG. If you are making simple updates to repo configuration, examples, or documentation, you do not need to add a changeset.

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.

1 participant