add dollar add dollar const a = '123'; const b = {} as {[key: string]: number}; b[a] = 123; $a = "123"; $b = array(); $b[$a] = 123;