Skip to content

Symbol

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.

1 exports Added in v2.0.0 Source

Guards

isSymbol

Added in v2.0.0 Source

Checks whether a value is a symbol.

When to use

Use to validate unknown input before treating it as a JavaScript symbol.

Signature

declare const isSymbol: (u: unknown) => u is symbol;