类型系统基础
类型系统高阶
模块组织史与工程
前端平台类型
工程化与综合
08-unions-intersections
08-unions-intersections/01-union-basics/demo/not-in-union.ts
typescript · 0.2 KB
运行:08 · union-basics
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
console
// 故意写错:boolean 不在 Id 联合里。 // 期望 tsc 报 TS2322(由 tsconfig.fail.json 触发)。 type Id = string | number; const id: Id = true; export { id };
该文件由构建期采集,未做任何改写;源码页不进入搜索引擎索引。