ts-toolbelt icon indicating copy to clipboard operation
ts-toolbelt copied to clipboard

[Improve]: Input limit of String.Join<> type

Open anuraghazra opened this issue 2 years ago • 0 comments

🐞 Bug Report

Describe the bug

Currently the Join<> type only works upto 22 input elements, after that It throws Type instantiation is excessively deep and possibly infinite.(2589)

Reproduce the bug

TSPlay

Expected behavior

Improve Join type to handle much larger inputs.

Possible Solution

Since 4.5, TS introduced tail recursion elimination on conditional types.

We can modify the Join function as such that it can handle inputs longer than 22 elements.

TSPlay

image

Screenshots

Current behaviour: image

Additional context

anuraghazra avatar Mar 28 '22 15:03 anuraghazra