# TS2589: Type instantiation is excessively deep and possibly infinite.

> A recursive generic type expands too deeply for the checker to resolve. Limit the recursion depth or simplify the type.

## What it means

Resolving the type needed more nested instantiations than the checker allows, so it stopped. This
usually comes from a recursive type alias or conditional type that keeps expanding without
reaching a base case the checker can see. tsc reports it at the recursive reference inside the
alias; ts-r-check currently reports it where the alias is used.

## Example

```ts
type Wrap<T> = T extends T ? Wrap<[T]> : never;
type X = Wrap<1>;
export {};
```

## How to fix

- Give the recursion a clear base case, or cap its depth with a counter tuple that stops early.
- Annotate intermediate values with simpler types so the deep type isn't needed.
- Split one large recursive type into smaller steps.

Source: https://ts-r.dev/errors/TS2589/
