TypeScript · Senior · Question 52 of 75

What does tail-recursion elimination for conditional types (TS 4.5) allow?

Explanation

Write recursive types with an accumulator so the recursive call is the whole branch result, e.g. Trim<Rest, [...Acc, X]>.

Further reading

Problem with a question

TypeScript · Senior · question 52

Test yourself

Take the TypeScript · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz