2
我不知道如果我可以使用枚举作为接口的对象键.. 我已经建立了一个小测试吧:使用枚举为打字稿界面键
export enum colorsEnum{
red,blue,green
}
export interface colorsInterface{
[colorsEnum.red]:boolean,
[colorsEnum.blue]:boolean,
[colorsEnum.green]:boolean
}
当我运行它,我” m得到以下错误:
A computed property name in an interface must directly refer to a built-in symbol.
我做错了或它只是不可能?