Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/yornaath/batshit
Browse files Browse the repository at this point in the history
  • Loading branch information
yornaath committed Jun 4, 2024
2 parents 04177cc + 23faeb3 commit d39767c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/batshit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ export const create = <T, Q, R = T>(
* @returns (item:T extends Array<A>, query: Q) => A
*/
export const keyResolver =
<T extends Array<any>, Q, R = T extends Array<infer A> ? A : never>(
key: T extends Array<infer A> ? keyof A : never
<T extends ReadonlyArray<any>, Q, R = T extends ReadonlyArray<infer A> ? A : never>(
key: T extends ReadonlyArray<infer A> ? keyof A : never
) =>
(items: T, query: Q): R =>
items.find((item) => item[key] == query) ?? null;
Expand Down

0 comments on commit d39767c

Please sign in to comment.