Skip to content

Commit

Permalink
refactor: make anys explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
kalisjoshua committed Dec 4, 2024
1 parent ebc4e4f commit 9d934f9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/core/src/utility/lookup/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { ExplicitAny } from '@/types';
import { identity } from '../../combinators/i';

/**
Expand All @@ -19,13 +18,13 @@ import { identity } from '../../combinators/i';
export const lookup =
<
A extends Record<string | number | symbol, unknown>,
B extends (...args: ExplicitAny[]) => ExplicitAny,
B extends CallableFunction,
>(
obj: A,
def?: B,
) =>
<C extends keyof A>(prop: string | number | symbol): A[C] => {
const fn = def ?? identity;
const fn: CallableFunction = def ?? identity;

return fn(obj[prop]);
};

0 comments on commit 9d934f9

Please sign in to comment.