示例工程 16-js-to-ts-migration
16-js-to-ts-migration/01-jsdoc-types/types.test-d.ts
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
type Equal<A, B> =
(<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false;
type Expect<T extends true> = T;
// 注意:类型测试配置只包含 TS;JS 的形状由 tsconfig.jsdoc.json 的 checkJs 负责
type Case1 = Expect<Equal<1, 1>>;