<A>(input: A): input is NonNullable<A>Checks whether a value is not null and not undefined.
When to use
Use when you need a Predicate refinement that filters out nullish values
but keeps other falsy ones.
Details
Uses input != null.
Example (Filtering non-nullish values)
import { Predicate } from "effect"
const values = [0, null, "", undefined]
const present = values.filter(Predicate.isNotNullish)
console.log(present)Source effect/Predicate.ts:9263 lines
export function function isNotNullish<A>(
input: A
): input is NonNullable<A>
Checks whether a value is not null and not undefined.
When to use
Use when you need a Predicate refinement that filters out nullish values
but keeps other falsy ones.
Details
Uses input != null.
Example (Filtering non-nullish values)
import { Predicate } from "effect"
const values = [0, null, "", undefined]
const present = values.filter(Predicate.isNotNullish)
console.log(present)
isNotNullish<function (type parameter) A in isNotNullish<A>(input: A): input is NonNullable<A>A>(input: Ainput: function (type parameter) A in isNotNullish<A>(input: A): input is NonNullable<A>A): input: Ainput is type NonNullable<T> = T & {}Exclude null and undefined from T
NonNullable<function (type parameter) A in isNotNullish<A>(input: A): input is NonNullable<A>A> {
return input: Ainput != null
}Referenced by 2 symbols