enum popupCount {
default = '0',
single = '1',
double = '2',
many = '4',
error = '404',
}
function AA(count:popupCount) {
return `http//localhost:5000/api/abc/#${count}`
}
通常来说 AA(popupCount.default)
这样调用。但有的时候是传参过来,可能拿到其他数字。希望能改成
function AA(count:popupCount) {
if(count is popupCount) // 这里的判断不知道该怎么写
return `http//localhost:5000/api/abc/#${count}`
else
return ''
}
以下写法也没用
Object.values(popupCount).includes(count)
count in popupCount
https://stackoverflow.com/que...