我在库(blueprintjs)中有一个常量。
export const Intent = {
NONE: "none" as "none",
PRIMARY: "primary" as "primary",
SUCCESS: "success" as "success",
WARNING: "warning" as "warning",
DANGER: "danger" as "danger",
};
export type Intent = typeof Intent[keyof typeof Intent];
我想确保我从父母那里收到的道具仅具有 Intent 的 5 个关键值之一。我该如何继续进行呢?请指教。
这是我到目前为止所做的。
interface Props {
exportButtonColor?: [keyof typeof Intent];
}
任何帮助是极大的赞赏。