type Equal = (() => T extends A ? 1 : 2) extends (() => T extends B ? 1 : 2) ? true : false; type Expect = T; import type { Direction, literal, widened, fixed, current } from './src/main.js'; type Case1 = Expect>; type Case2 = Expect>; type Case3 = Expect>; type Case4 = Expect>; // widened 已经变成 string,不能再直接赋给 Direction // @ts-expect-error: string 不能赋给字面量联合 const assigned: Direction = widened; // 标注后非法值被拒绝 // @ts-expect-error: north 不在 Direction 中 const invalid: Direction = 'north'; export { assigned, invalid };