cf.completefrontend

Predict the typesMedium

Why can you spread point into sum but not into move?

Name the type each ^? line points at, and every error TypeScript reports.

What does TypeScript report here?
function move(x: number, y: number) {  return `${x},${y}`;} function sum(...values: number[]) {  return values.reduce((total, value) => total + value, 0);} const point = [3, 4];//    ^?const fixed = [3, 4] as const;//    ^?type MoveArgs = Parameters<typeof move>;//   ^? sum(...point);move(...point);move(...fixed);

Work it out first: the compiler shows every error and type.

The answer

Work out every error TypeScript reports and every type it shows, line by line. Then check.

Checking your sign-in…