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

Make "pick" helper types less restrictive #40

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

dknutsen
Copy link
Contributor

@dknutsen dknutsen commented Feb 5, 2025

In our codebase we frequently use the pick helper with objects that aren't Events (although that is one of the more common use cases). For example we have generic components that fire an action with an object, and we only want one property from the object to be passed up the action chain to more specific components. e.g.:

// the object passed into the `onSave` action inside the child component:
{
  foo: { ... }, 
  bar: { ... },
}

// the parent component template:
  <ChildComponent
    @onSave={{pick "foo" @onSave}}
  />

This attempts to relax the typing on the pick helper so it will accept either an object (or rather Record<string, unknown>) OR an Event.

In our codebase we frequently use the pick helper with objects that aren't Events (although that is one of the more common use cases). For example we have generic components that fire an action with an object, and we only want one property from the object to be passed up the action chain to more specific components. This attempts to relax the typing on the pick helper so it will accept either an object (or rather `Record<string, unknown>`) OR an Event.
Copy link
Owner

@NullVoxPopuli NullVoxPopuli left a comment

Choose a reason for hiding this comment

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

seems good 🎉

@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Feb 5, 2025
@NullVoxPopuli NullVoxPopuli merged commit c615364 into NullVoxPopuli:main Feb 5, 2025
13 checks passed
@github-actions github-actions bot mentioned this pull request Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants