when using let s = Symbol()
to declare the symbol as key of an object, such as:
let a = { [s]:1 }
the type of a
will automatically become {[x:string]:number}
whereas it will get error when try to index like a[s]
:
Type 'symbol' cannot be used as an index type (2538)
while use const s = Symbol()
declaration is work as become to {[s]:number}
.