# Symbol
A primitive data type representing a unique global symbol.
The symbol type is very similar to JavaScript's (MDN (opens new window)), but is not deeply integrated with the compiler yet.
# Construction
- Creates a new unique symbol. Note that this is not a constructor (symbols are primitive data types) so cannot be invoked with
function Symbol(description?: string): symbol
new
.
# Static members
function for(key: string): symbol
Obtains the existing unique symbol for the specified global key or creates a new unique symbol if the key does not exist.
function keyFor(sym: symbol): string | null
Obtains the global key of the specified unique symbol, if any.
# Instance members
- Returns a string representation of the symbol of the form
function toString(): string
"Symbol(key?)"
.
← String TypedArray →