首页 > 解决方案 > TypeScript 如何检测始终到达或无法到达的代码块?

问题描述

例如:

const a = true;
if (!a) {
    // not reachable, but no warning here
}

有什么方法可以让 TS 检查这些逻辑错误吗?

标签: typescript

解决方案


推荐阅读