TypeScript · Senior · Question 10 of 75

What are variadic tuple types?

type Concat<A extends unknown[], B extends unknown[]> = [...A, ...B];

Explanation

Concat<[1, 2], ['a']> → [1, 2, 'a']. This lets you precisely type concat, curry, Promise.all and wrapper functions with prefix arguments.

Further reading

Problem with a question

TypeScript · Senior · question 10

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