symbol

A primitive value created by Symbol() that is guaranteed unique, used as a property key that can never clash with another.

In more detail

Two symbols with the same description are still different, so libraries use them for hidden or internal keys. Decorator metadata is stored under the built-in Symbol.metadata key. Inside the compiler, symbol also names the record the binder keeps for each declaration, which is a different thing.

Example

const internalKey: symbol = Symbol("session_id");

Related terms

Taught in

References