TypeScript Types
unique symbol — declaration-specific symbol type
A unique symbol type identifies a particular symbol declaration. Use a const declaration or a static readonly class member; refer to that exact type via a type-position typeof query. Different unique symbol declarations are not mutually assignable. This is a static identity model; it is not a runtime security or privacy mechanism. Example output: "ready". The example was designed for strict checking with an ES2022 target; type annotations do not add runtime validation.
Formal Syntax & Structure
typescript syntaxtypescript
const key: unique symbol = Symbol();Working Example
Example Snippettypescript
const token: unique symbol = Symbol("token");const record = { [token]: "ready" };const alias: typeof token = token;console.log(record[alias]);