Hyperlinkv0.8.0-beta.28

Predicate

Predicate.isNotNullishfunctioneffect/Predicate.ts:926
<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)
export function isNotNullish<A>(input: A): input is NonNullable<A> {
  return input != null
}
Referenced by 2 symbols