You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typescript infers that if you touch the arguments value inside a function that it has extra arguments as ...args: any[]
However if you call a method with an object and one of the fields is called arguments: [] then it thinks you are using the arguments variable inside of the function, then it adds ...args: any[]
but i'm actually using arguments.length to just simply validating/asserting if the number of arguments is correct at runtime. This only occur in .js (not in .ts)
javascript:
typescript:
I think the better option would be to not add ...args[]: any at all if you use arguments...
the new normal is that you instead use spread when you actually mean to support any number of arguments
Typescript infers that if you touch the
arguments
value inside a function that it has extra arguments as...args: any[]
However if you call a method with an object and one of the fields is called
arguments: []
then it thinks you are using thearguments
variable inside of the function, then it adds...args: any[]
https://www.typescriptlang.org/play?filetype=js#code/LAKAxg9gdgzgLgAhgT3gUwLYILwIN5JpQAmAFBAJT4C+C1ooAZhBAEYCGATqQOTRo8KAbgYgA9ACoJoBBIQABAA5d2WPPE4BLKAHNa-GRLFMArlDBxN0BMzZcE5KGip4ZSVHEwA6GETKuQBCCEdkVNAC4EHlsOTh4AGjcgrh0TDCI4GEiAbR4ACzQAG0KIHgBdN2oKUGogA
The text was updated successfully, but these errors were encountered: