TS2574

error TS2574: A rest element type must be an array type.

Broken Code ❌

1
2
3
type Operation = '+' | '-';

type Calculation = [Operation, ...number];

Fixed Code ✔️

Simply turn ...number into ...number[]:

1
2
3
type Operation = '+' | '-';

type Calculation = [Operation, ...number[]];