deep-utility-types icon indicating copy to clipboard operation
deep-utility-types copied to clipboard

Type instantiation is excessively deep and possibly infinite

Open moham96 opened this issue 1 year ago • 4 comments

If the type is deep enough, typescript will lag and throw this error "Type instantiation is excessively deep and possibly infinite"

moham96 avatar Sep 06 '24 21:09 moham96

I suppose a solution could be to add a maximum depth to the recursive types, which should be fairly doable.

I'm open to a PR, but I'm probably not going to have time to fix this issue myself at the moment.

tobloef avatar Sep 06 '24 21:09 tobloef

@moham96 @tobloef

If you don't mind, I made a type to solve the above problem, is it okay if you link it here? My open source is similar to your type, but I'm dealing with your issues more deeply. If you don't have time to develop it, how about sharing my open source, and developing it together later? I want someone to develop with me. If what I'm saying is weird it's because my main language is not English, so please understand.

kakasoo avatar Jan 26 '25 08:01 kakasoo

@kakasoo Yes, feel free to share a link to your repository if you have something others might find relevant 😃

tobloef avatar Jan 26 '25 08:01 tobloef

Thanks!

I've created types like DeepStrictObjectKeys, DeepStrictPick, and DeepStrictOmit that can infer keys regardless of depth, and now I want to provide them in the form of functions one by one. Please use them if you're interested.

kakasoo avatar Jan 28 '25 13:01 kakasoo