我对我的应用具有以下访问权限级别
type accessLevels = "ReadOnly" | "Write" | "Admin";
后端返回包含访问级别的level
对象数组。
const levels = [
{
access: "ReadOnly"
},
{
access: "Write"
}
]
基于上述内容,我通过以下方式显示/隐藏了应用的某些部分:
const hasWriteAccess: boolean = level.some((level) => {
return level.access === "Write" || level.access === "Admin";
});
我正在尝试绕过level.access === "Write" || level.access === "Admin"
,而做类似level.access > "ReadOnly
的事情。此imo将简化逻辑。我有什么办法可以做到这一点?