-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
...args should not be readonly within function body #53398
Comments
Hmm, but |
Like, how would it be implemented? Or something else? |
in short: how could |
Well, the idea I (rather @weswigham) had was to copy So, the function is typed the same. |
Sorta kinda the same as what I did for spread types in assignments, which implicitly drops certain properties (#47078). |
@jakebailey feel free to self-assign if you want to |
Bug Report
π Search Terms
readonly parameter inferred tuple array args variadic
π Version & Regression Information
β― Playground Link
Playground Link
π» Code
π Actual behavior
...args
is readonly.π Expected behavior
...args
is not readonly.When this function is called, the input will be a brand new array which can be modified without affecting the caller:
Split out of #53258 (comment)
The "fix" here is to strip readonly from variadic args (at the top level). This also means the fix in #53258 can be reverted (as the real fix can be more general).
The text was updated successfully, but these errors were encountered: