DocsPlaygroundBlogCommunityPackages
  • Playground
  • Blog
  • Community
  • Packages
  • X
  • Bluesky
  • GitHub
  • Forum
Language ManualAPISyntax LookupReact
Overview
Stdlib
submodules
  • Array
  • ArrayBuffer
  • AsyncIterator
  • BigInt
  • BigInt64Array
    • Constants
    BigUint64Array
    • Constants
  • Bool
  • Console
  • DataView
  • Date
    • UTC
  • Dict
  • Error
    • URIError
    • TypeError
    • SyntaxError
    • ReferenceError
    • RangeError
    • EvalError
  • Exn
  • Float
    • Constants
    Float32Array
    • Constants
    Float64Array
    • Constants
    Int
    • Ref
    • Bitwise
    • Constants
    Int16Array
    • Constants
    Int32Array
    • Constants
    Int8Array
    • Constants
  • IntervalId
  • Intl
    • Segments
    • Segmenter
    • RelativeTimeFormat
    • PluralRules
    • NumberFormat
      • Grouping
    • Locale
    • ListFormat
    • DateTimeFormat
    • Collator
    • Common
  • Iterator
  • JSON
    • Decode
    • Encode
    • Classify
    JsError
    • URIError
    • TypeError
    • SyntaxError
    • ReferenceError
    • RangeError
    • EvalError
  • JsExn
  • Lazy
  • List
  • Map
  • Math
    • Int
    • Constants
  • Null
  • Nullable
  • Object
  • Option
  • Ordering
  • Pair
  • Promise
  • RegExp
    • Result
  • Result
  • Set
  • String
  • Symbol
    • t
      t
    • v
      make
    • v
      getFor
    • v
      keyFor
    • v
      description
    • v
      toString
    • v
      asyncIterator
    • v
      hasInstance
    • v
      isConcatSpreadable
    • v
      iterator
    • v
      match
    • v
      matchAll
    • v
      replace
    • v
      search
    • v
      species
    • v
      split
    • v
      toPrimitive
    • v
      toStringTag
    • v
      unscopables
    • v
      ignore
  • TimeoutId
  • Type
    • Classify
  • TypedArray
  • Uint16Array
    • Constants
    Uint32Array
    • Constants
    Uint8Array
    • Constants
    Uint8ClampedArray
    • Constants
  • WeakMap
  • WeakSet
  • Docs / API / Stdlib / Symbol

    Symbol

    A built-in object that serves as a namespace for globally-unique identifiers.

    Compiles to a regular JavaScript Symbol.

    t

    RESCRIPT
    type t

    Type representing a Symbol.

    make

    RESCRIPT
    let make: string => t

    make(key)

    Makes a new unique Symbol value.

    Examples

    RESCRIPT
    Symbol.make("sym1")->Symbol.description == Some("sym1")

    getFor

    RESCRIPT
    let getFor: string => option<t>

    getFor(key)

    Searches for existing registered Symbols in the global Symbol registry with the given key and returns it if found. Otherwise a new Symbol gets created and registered with key.

    Examples

    RESCRIPT
    Symbol.getFor("sym1") == Symbol.getFor("sym1")

    keyFor

    RESCRIPT
    let keyFor: t => option<string>

    keyFor(key)

    Retrieves a shared Symbol key from the global Symbol registry for the given Symbol.

    Examples

    RESCRIPT
    let globalSym = Symbol.getFor("sym1") // Global symbol globalSym->Option.flatMap(Symbol.description) == Some("sym1")

    description

    RESCRIPT
    let description: t => option<string>

    description

    Returns Some(string) containing the description of this symbol, or None if the symbol has no description.

    Examples

    RESCRIPT
    let sym = Symbol.make("sym1") Symbol.description(sym) == Some("sym1")

    toString

    RESCRIPT
    let toString: t => string

    toString

    // Returns a string representing this symbol value.

    Examples

    RESCRIPT
    let sym = Symbol.make("sym1") Symbol.toString(sym) == "Symbol(sym1)"

    asyncIterator

    RESCRIPT
    let asyncIterator: t

    hasInstance

    RESCRIPT
    let hasInstance: t

    isConcatSpreadable

    RESCRIPT
    let isConcatSpreadable: t

    iterator

    RESCRIPT
    let iterator: t

    match

    RESCRIPT
    let match: t

    matchAll

    RESCRIPT
    let matchAll: t

    replace

    RESCRIPT
    let replace: t

    search

    RESCRIPT
    let search: t

    species

    RESCRIPT
    let species: t

    split

    RESCRIPT
    let split: t

    toPrimitive

    RESCRIPT
    let toPrimitive: t

    toStringTag

    RESCRIPT
    let toStringTag: t

    unscopables

    RESCRIPT
    let unscopables: t

    ignore

    RESCRIPT
    let ignore: t => unit

    ignore(symbol) ignores the provided symbol and returns unit.

    This helper is useful when you want to discard a value (for example, the result of an operation with side effects) without having to store or process it further.

    Types and values
    • t
      t
    • v
      make
    • v
      getFor
    • v
      keyFor
    • v
      description
    • v
      toString
    • v
      asyncIterator
    • v
      hasInstance
    • v
      isConcatSpreadable
    • v
      iterator
    • v
      match
    • v
      matchAll
    • v
      replace
    • v
      search
    • v
      species
    • v
      split
    • v
      toPrimitive
    • v
      toStringTag
    • v
      unscopables
    • v
      ignore

    © 2025 The ReScript Project

    About
    • Community
    • ReScript Association
    Find us on