StaticJsSymbol
A sandboxed symbol value.
Import
import { type StaticJsSymbol, isStaticJsSymbol } from "@suntime-js/core";
Overview
StaticJsSymbol is classified as a scalar in JavaScript semantics (it appears in the StaticJsScalar union and isStaticJsScalar returns true for it), but its interface also extends StaticJsObject. This lets the sandbox support Symbol.prototype method access internally.
For most host code, treat StaticJsSymbol like any other scalar: read .value to get the native symbol, and use isStaticJsSymbol to narrow.
Extends
StaticJsObject → StaticJsPrimitive
Also included in StaticJsScalar.
Factory
realm.types.symbol(description?)
Well-known symbols: realm.types.symbols
Properties
Inherits all properties from StaticJsPrimitive.
value
Type: symbol
The native host symbol wrapped by this sandbox value.
description
Type: string | undefined
The optional description string of the symbol, equivalent to Symbol.prototype.description.
typeOf
"symbol"
runtimeTypeOf
"symbol"
Methods
Inherits all methods from StaticJsObject.
toNative()
toNative(): symbol
Returns the native host symbol. This is safe to call, as symbols coerce to a plain native symbol with no proxy indirection.
See Type Coercion for the complete coercion rules.
Type guard
isStaticJsSymbol(value)
isStaticJsSymbol(value: unknown): value is StaticJsSymbol