type N0 = [];
type succ<N> = [any, N];
type N1 = succ<N0>
type N2 = succ<N1>
type N3 = succ<N2>
type pred<N> = N extends [any, infer R] ? R : never;
type NEQUAL<Na, Nb> = Na extends Nb ? any : never;
type testNEQUAL = NEQUAL<pred<N2>, succ<N0>> // any
type add<Na, Nb> = Nb extends N0 ? Na : add<succ<Na>, pred<Nb>>
// Type alias 'add' circularly references itself.
type ValueOrArray<T> = T | Array<ValueOrArray<T>>; // OK
type ValueOrArray<T> = T | ValueOrArray<Array<T>>; // NG
ts
type add<Na, Nb> = Nb extends N0 ? Na : add2<Na, Nb>;
interface add2<Na, Nb> extends add<succ<Na>, pred<Nb>> { }; // NG
// An interface can only extend an object type or intersection of object types with statically known members.