TypeScript · Middle · Question 39 of 75
What is unique symbol?
- ✓Correct answer: The type of a specific symbol declared via
const s = Symbol() - 2Any value of type
symbol, includingSymbol.for() - 3A symbol that can't be used as an object key
Explanation
Each const with Symbol() gets its own unique symbol subtype, so TS distinguishes such keys. This is used for "hidden" properties and type branding. A plain symbol describes any symbol.