type Expect<T extends true> = T;
`T extends true` puts a type constraint on the parameter, which then needs to be assignable to the literal type `true` to type-check.
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends < T >() => T extends Y ? 1 : 2 ? true : false;
Understanding this requires a bit more context, but I'll explain why we need something so complicated in the Advanced Union Types chapter :)
I picked it from https://github.com/type-challenges/type-challenges which is an awesome resource too
Create an account to get your API key.
type Expect<T extends true> = T;
`T extends true` puts a type constraint on the parameter, which then needs to be assignable to the literal type `true` to type-check.