My experience with Typescript is still new, and I could use some guidance in resolving the error message
Type instantiation is excessively deep and possibly infinite.(2589)
You can access the playground here.
To identify the error, uncomment the Type ExpandThrowAnError
.
Context.
I have developed two Generics to assist me in defining APIs. Each object returned by an API may contain keys that can be expanded as needed during a request.
Therefore, the generic KeysCanBeExpanded
helps retrieve all expandable keys on an object, while Expand
allows for expanding the object based on specified keys.
Individually, these two Generics work smoothly, but upon merging them, the compiler raises an issue stating
Type instantiation is excessively deep and possibly infinite.(2589)