📜  来自枚举的 typescript 键值接口键 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:35.900000             🧑  作者: Mango

代码示例1
export type colorsInterface = {
    [key in colorsEnum]?: boolean;
};

let example: colorsInterface = {
    [colorsEnum.red]: true,
    [colorsEnum.blue]: false
};