<A>(input: A): input is Exclude<A, null>Checks whether a value is not null.
When to use
Use when you need a Predicate refinement that filters out null while
preserving other falsy values.
Details
Returns a refinement that excludes null.
Example (Filtering null values)
import { Predicate } from "effect"
const values = [1, null, 2]
const nonNull = values.filter(Predicate.isNotNull)
console.log(nonNull)Source effect/Predicate.ts:8613 lines
export function function isNotNull<A>(
input: A
): input is Exclude<A, null>
Checks whether a value is not null.
When to use
Use when you need a Predicate refinement that filters out null while
preserving other falsy values.
Details
Returns a refinement that excludes null.
Example (Filtering null values)
import { Predicate } from "effect"
const values = [1, null, 2]
const nonNull = values.filter(Predicate.isNotNull)
console.log(nonNull)
isNotNull<function (type parameter) A in isNotNull<A>(input: A): input is Exclude<A, null>A>(input: Ainput: function (type parameter) A in isNotNull<A>(input: A): input is Exclude<A, null>A): input: Ainput is type Exclude<T, U> = T extends U
? never
: T
Exclude from T those types that are assignable to U
Exclude<function (type parameter) A in isNotNull<A>(input: A): input is Exclude<A, null>A, null> {
return input: Ainput !== null
}