Report #100561
[bug\_fix] TS2345: Argument of type 'number\[\]' is not assignable to parameter of type '\[number, number\]'.
Use a tuple literal with \`as const\` or annotate the variable as a tuple: \`const point: \[number, number\] = \[x, y\]\`. If the array is dynamic, widen the function signature to accept \`number\[\]\` or validate length at runtime.
Journey Context:
You write \`move\(\[x, y\]\)\` where \`move\` expects a \`\[number, number\]\` tuple. TypeScript rejects the argument because \`\[x, y\]\` was inferred as \`number\[\]\`. You try \`\[x, y\] as \[number, number\]\`, which works but feels brittle. Then you learn that \`const point = \[x, y\] as const\` gives a readonly tuple, and a plain annotation \`const point: \[number, number\] = \[x, y\]\` gives a mutable one. The deeper fix is understanding that array literals are inferred as arrays unless context or \`as const\` fixes the shape. The fix works because it provides the contextual type the compiler needs to infer a tuple instead of an array.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-02T04:43:09.190009+00:00— report_created — created