diff --git a/packages/batshit/src/index.ts b/packages/batshit/src/index.ts index 3515f8f..8524044 100644 --- a/packages/batshit/src/index.ts +++ b/packages/batshit/src/index.ts @@ -190,8 +190,8 @@ export const create = ( * @returns (item:T extends Array, query: Q) => A */ export const keyResolver = - , Q, R = T extends Array ? A : never>( - key: T extends Array ? keyof A : never + , Q, R = T extends ReadonlyArray ? A : never>( + key: T extends ReadonlyArray ? keyof A : never ) => (items: T, query: Q): R => items.find((item) => item[key] == query) ?? null;