Symbol.ts
Symbol.ts overview
Section titled “Symbol.ts overview”The Symbol module contains the runtime predicate for JavaScript primitive
symbol values. It is most useful at boundaries where a value is unknown
and must be narrowed before it can be used as a symbol key, identifier, or
discriminant.
Since v2.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”guards
Section titled “guards”isSymbol
Section titled “isSymbol”Checks whether a value is a symbol.
When to use
Use to validate unknown input before treating it as a JavaScript symbol.
Example (Checking for symbols)
import { Symbol } from "effect"
console.log(Symbol.isSymbol(globalThis.Symbol.for("a"))) // trueconsole.log(Symbol.isSymbol("a")) // falseSignature
declare const isSymbol: (u: unknown) => u is symbolSince v2.0.0