millsp / ts-toolbelt

πŸ‘· TypeScript's largest type utility library

Home Page:https://millsp.github.io/ts-toolbelt/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

anuraghazra opened this issue Β· 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