Hyperlinkv0.8.0-beta.28

Predicate

Predicate.isSymbolfunctioneffect/Predicate.ts:669
(input: unknown): input is symbol

Checks whether a value is a symbol.

When to use

Use when you need a Predicate guard to narrow an unknown value to a symbol.

Details

Uses typeof input === "symbol".

Example (Guarding symbols)

import { Predicate } from "effect"

const data: unknown = Symbol.for("id")

if (Predicate.isSymbol(data)) {
  console.log(data.description)
}
export function isSymbol(input: unknown): input is symbol {
  return typeof input === "symbol"
}
Referenced by 5 symbols