Skip to content

Commit

Permalink
Merge pull request #40 from dknutsen/patch-1
Browse files Browse the repository at this point in the history
Make "pick" helper types less restrictive
  • Loading branch information
NullVoxPopuli authored Feb 5, 2025
2 parents 34865d8 + b603d37 commit c615364
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ember-composable-helpers/src/helpers/pick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { helper } from '@ember/component/helper';
import { get } from '@ember/object';
import type { AnyVoidFn } from '../utils/types';

export function pick([path, action]: [string, AnyVoidFn]) {
return function(event: Event) {
let value = get(event, path);
export function pick<T extends Event | Record<string, unknown>>([path, action]: [string, AnyVoidFn]) {
return function(obj: T) {
let value = get(obj, path);

if (!action) {
return value;
Expand Down

0 comments on commit c615364

Please sign in to comment.