Given a symbol
const title = Symbol('Csv column title');
representing a key of an object and the text of a header in a table. I thought I could setup the headers like so
const tableHeaders: { key: string }[] = [{ key: title }];
but unfortunately I get the errors
Type 'symbol' is not assignable to type 'string'.(2322)
and
TypeError: Cannot convert a Symbol value to a string
It seems Symbol.prototype.toString() is not what I'm looking for since Symbol('title').toString()
returns "Symbol(title)"
.
How can I use the symbol as a string?