type Equal = (() => T extends A ? 1 : 2) extends (() => T extends B ? 1 : 2) ? true : false; type Expect = T; import type { Input, firstValue } from './src/main.js'; type Case1 = Expect[0], Input>>; type Case2 = Expect, string>>; // 未收窄的联合类型不能直接当 string 用 // @ts-expect-error: string[] 分支上没有 toUpperCase const bad: string = (undefined as unknown as Input).toUpperCase(); export { bad };