Variadic Tuple Types
Updated: January 16, 2021
type Foo<T extends any[]> = [boolean, ...T, boolean]
Before TS@4.0
...T
would need to be the last element, but now we can spread the T
type nested between known types; e.g. “This array will have a boolean, with some stuff (strings, numbers, etc.), and another boolean”.