Symbols in TypeScript
Briefly

This article explores how TypeScript manages JavaScript symbols at the type level, particularly the distinction between unique symbols and broader symbol types. It emphasizes the behavior of type inference in variable declarations, noting that assignment can inadvertently broaden the type. The unique symbol, serving as a subtype of symbol, represents a specific location rather than a value. Understanding these constraints is crucial for developers seeking to effectively utilize symbols in TypeScript, impacting both variable declarations and property definitions.
When we assign a SYM with the type typeof SYM to another variable X, the type of the latter is broadened to symbol - even though we declare it with const.
The type unique symbol is a subtype of symbol. It means that this particular location holds a symbol with a particular type.
Read at 2ality
[
|
]