# 04 · never-exhaustive **演示**:`assertNever(value: never)` 让漏掉分支变成编译错误;运行时它只负责抛错兜底。 **运行**:在 `tutorials/typescript` 下执行 `npm run build`,再执行 `npm run serve`,打开 `http://localhost:8080/examples/02-basic-types-inference/04-never-exhaustive/`;开 Console。 **预期控制台输出**: ```text circle:3.14 square:9 rect:10 ``` **类型检查**:`node node_modules/typescript/bin/tsc -p examples/02-basic-types-inference/04-never-exhaustive/tsconfig.types.json` **注意**:给 `Shape` 增加 `{ kind: 'triangle' }` 后,`default` 分支里的 `shape` 不再是 `never`,`tsc` 会报 `TS2345`。