由于 - 符号,我无法输入对象开关?

I can't enter the object switch because of the - sign?

正在从 API 返回一个对象,我想访问键“official-artwork”,但由于 - 符号我无法访问键“official-artwork”。

dream_world: {value}
home: {value}
official-artwork: {value}

当我在 js 终端输入时,出现 "item?.sprites.other.official-artwork" 错误,我该如何解决?

试试这个:

item?.sprites.other['official-artwork']

将其放在块和引号中:

item?.sprites.other["official-artwork"]