version-rocket icon indicating copy to clipboard operation
version-rocket copied to clipboard

tsc报错error TS7029: Fallthrough case in switch.

Open caocong1 opened this issue 2 years ago • 4 comments

https://github.com/guMcrey/version-rocket/blob/2111135aea012220c14e028c24cd0b02873ab6fe/utils/index.ts#L147-L49

switch (cancelModeType) {
    case 'ignore-current-version':
      if (newVersion && cancelModeTypeValue === newVersion) {
        isStopWorker && worker?.terminate()
        return true
      }
+     break
    case 'ignore-today':
      if (cancelModeTypeValue === todayDate) {
        isStopWorker && worker?.terminate()
        return true
      }
      break
    case 'ignore-current-window':
      if (cancelModeTypeValueInSession) {
        isStopWorker && worker?.terminate()
        return true
      }
      break
    default:
      break
  }

在case 'ignore-current-version':里缺少一个break

caocong1 avatar Mar 11 '24 04:03 caocong1

收到, 谢谢你的反馈, 我会尽快修复的♥️

guMcrey avatar Mar 11 '24 08:03 guMcrey

@caocong1 你好呀, 想问下 "tsc报错error TS7029: Fallthrough case in switch" 这个报错是在什么情况下触发的呢?

guMcrey avatar Mar 11 '24 08:03 guMcrey

@caocong1 你好呀, 想问下 "tsc报错error TS7029: Fallthrough case in switch" 这个报错是在什么情况下触发的呢?

tsconfig.json里配置noFallthroughCasesInSwitch这个就会提示这个错误。

{
  "compilerOptions": {
    ...
    "strict": true,
    "noFallthroughCasesInSwitch": true
  },
  ...
}

caocong1 avatar Mar 12 '24 06:03 caocong1

收到, 修复啦

guMcrey avatar Mar 13 '24 08:03 guMcrey