- Error
- Reported by the type checker
TS2469
The '{0}' operator cannot be applied to type 'symbol'.
An arithmetic or comparison operator is applied to a symbol. Symbols can't be converted to numbers; use the symbol's description or compare with ===.
What it means
Symbols throw a TypeError when converted to a number or string implicitly. Operators like +, -, < or unary + on a value of type symbol are reported.
Example
const tag = Symbol("tag");
export const n = +tag;
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(2,19): error TS2469: The '+' operator cannot be applied to type 'symbol'.
Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.
How to fix
- Use
tag.descriptionorString(tag)if you need text. - Compare symbols with
===, which works without conversion.