I am creating a function that takes a path, a value and optionally an object that will find the path in the object and return if it matches the value, my problem is i am having a hard time typing this.
however, this requires me to set the type when using it which I don't like
I would like to return type to be inferred from the arguments passed
PHP Code
<?php
import * as R from 'ramda';
export type PropEqCurry = (obj: any) => boolean
export type PropEqCall = boolean
export type PropEq = PropEqCurry | PropEqCall
export const propEq = (path: string, value: any, obj?: Object): PropEq => (obj
? R.equals(pick(path, obj), value)
: (obj: any) => R.equals(pick(path, obj), value));
however, this requires me to set the type when using it which I don't like
PHP Code
<?php
const checkName = propEq('name', 'jest') as PropEqCurry;
I would like to return type to be inferred from the arguments passed
¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´


