Closed frankpf closed 6 years ago
I'm trying to check if an array has an undefined value using any(equals(undefined)):
any(equals(undefined))
import { any, equals } from 'ramda' const test = any(equals(undefined), [1, 2, 3, 4, undefined])
The issue is that the type of equals is equals<T>(a: T, b: T): boolean. The type makes sense for all parameters other than null and undefined.
equals
equals<T>(a: T, b: T): boolean
null
undefined
To type check correctly in this case, I have to parametrize it to equals<number | undefined>. This works, but it is a bit inconvenient.
equals<number | undefined>
This probably could be resolved by adding two function overloads:
equals<T>(a: undefined, b: T | undefined): boolean; equals<T>(a: null, b: T | null): boolean;
Sounds fair! Might be we still had some similar (T, T) types (other comparison functions?) still suffering from this as well.
(T, T)
I'm trying to check if an array has an undefined value using
any(equals(undefined))
:The issue is that the type of
equals
isequals<T>(a: T, b: T): boolean
. The type makes sense for all parameters other thannull
andundefined
.To type check correctly in this case, I have to parametrize it to
equals<number | undefined>
. This works, but it is a bit inconvenient.This probably could be resolved by adding two function overloads: