Type Alias TsTooMuchRecursion

TsTooMuchRecursion

Through experimentation on Typescript version 5.4.5, this is the maximum recursion depth we can go to before TypeScript will block recursive types. Use this as the limit to type recursion.

import type {
TsRecursionTracker,
TsRecursionStart,
TsRecurse,
TsTooMuchRecursion,
} from '@augment-vir/common';

export type SomeType<Depth extends TsRecursionTracker = TsRecursionStart> =
Depth extends TsTooMuchRecursion
? 'Error: recursive object depth is too deep.'
: SomeType<TsRecurse<Depth>>;