effect-io-ai

Package: effect
Module: HashSet

HashSet.empty

Creates an empty HashSet.

Time complexity: O(1)

Example

import { HashSet, pipe } from "effect"

console.log(
  pipe(
    // Provide a type argument to create a HashSet of a specific type
    HashSet.empty<number>(),
    HashSet.add(1),
    HashSet.add(1), // Notice the duplicate
    HashSet.add(2),
    HashSet.toValues
  )
) // Output: [1, 2]

See

Signature

declare const empty: <A = never>() => HashSet<A>

Source

Since v2.0.0