-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove unnecessary constraint from propEq value: the function should receive any type values of object, no matter what parameter it received; * add additional types to use with placeholder
- Loading branch information
Showing
3 changed files
with
47 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
export function propEq<T>(val: T): { | ||
<K extends PropertyKey>(name: K): (obj: Record<K, T>) => boolean; | ||
<K extends PropertyKey>(name: K, obj: Record<K, T>): boolean; | ||
import { Placeholder } from 'ramda'; | ||
|
||
export function propEq(__: Placeholder): never; | ||
export function propEq<V>(val: V): { | ||
<K extends PropertyKey>(name: K): (obj: Record<K, any>) => boolean; | ||
<U extends Record<PropertyKey, any>>(__: Placeholder, obj: U): (name: keyof U) => boolean; | ||
<K extends keyof U, U extends Record<PropertyKey, any>>(name: K, obj: U): boolean; | ||
}; | ||
export function propEq<T, K extends PropertyKey>(val: T, name: K): (obj: Record<K, T>) => boolean; | ||
export function propEq<K extends keyof U, U>(val: U[K], name: K, obj: U): boolean; | ||
export function propEq<K extends PropertyKey>(__: Placeholder, name: K): { | ||
(__: Placeholder, obj: Record<K, any>): <V>(val: V) => boolean; | ||
<V>(val: V, obj: Record<K, any>): boolean | ||
<V>(val: V): (obj: Record<K, any>) => boolean | ||
}; | ||
export function propEq<V, K extends PropertyKey>(val: V, name: K): (obj: Record<K, any>) => boolean; | ||
|
||
|
||
export function propEq<U extends Record<any, any>>(__: Placeholder, ___: Placeholder, obj: U): { | ||
<V extends Exclude<any, Placeholder>>(val: V, name: keyof U): boolean; | ||
<V extends Exclude<any, Placeholder>>(val: V): (name: keyof U) => boolean; | ||
}; | ||
export function propEq<K extends PropertyKey>(__: Placeholder, name: K, obj: Record<K, any>): <V>(val: V) => boolean; | ||
export function propEq<V, U extends Record<any, any>>(val: V, __: Placeholder, obj: U): (name: keyof U) => boolean; | ||
export function propEq<U extends Record<any, any>>(val: Exclude<any, Placeholder>, name: keyof U, obj: U): boolean; |