Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot write type annotation for variadic function #7159

Open
Chriscbr opened this issue Sep 23, 2024 · 0 comments
Open

Cannot write type annotation for variadic function #7159

Chriscbr opened this issue Sep 23, 2024 · 0 comments
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler

Comments

@Chriscbr
Copy link
Contributor

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

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@Chriscbr Chriscbr added 🐛 bug Something isn't working 🛠️ compiler Compiler labels Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler
Projects
Status: 🆕 New - not properly defined
Development

No branches or pull requests

1 participant