This comparison appears to be unintentional because the types '"up " | "down"' and '"up"' have no overlap. <ArkTSCheck>
onToggle(dir: "up" | "down") {
const idList = AppStorage.get('idList') as string[]
idList.indexOf(this.questionId)
if (dir === "up ") {
return
}
这个错误提示表明您正在进行的比较可能不是有意的,因为比较的两个类型 'up ' | 'down'
和 'up'
没有重叠部分。
可能您在代码中的某个条件判断中,将这两个不同类型的值进行了比较,而它们的可能取值没有共同之处,这可能不符合您的预期逻辑,您需要检查并修正比较的操作或数据类型。
之前up后面多了一个空格,删掉就好了
onToggle(dir: "up" | "down") {
const idList = AppStorage.get('idList') as string[]
idList.indexOf(this.questionId)
if (dir === "up") {
return
}
}
标签:comparison,because,idList,up,down,dir,string
From: https://blog.csdn.net/hqy1989/article/details/142924110