winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
5.06k stars 198 forks source link

Cannot write type annotation for variadic function #7159

Open Chriscbr opened 2 months ago

Chriscbr commented 2 months ago

I tried this:

Giving an explicit type annotation for a variadic function:

let t5: (...Array<num>): num = (...arr: Array<num>) => {
  let var total = 0;
  for x in arr {
    total += x;
  }
  return total;
};

This happened:

Syntax error

I expected this:

No error

Is there a workaround?

Let the type be inferred

Anything else?

No response

Wing Version

0.85.12

Node.js Version

No response

Platform(s)

MacOS

Community Notes