Skip to content

fix(types): add Unit x array overloads for multiply and dotMultiply - #3691

Open
abhijeet117 wants to merge 1 commit into
josdejong:developfrom
abhijeet117:fix/unit-array-multiply-overloads
Open

fix(types): add Unit x array overloads for multiply and dotMultiply#3691
abhijeet117 wants to merge 1 commit into
josdejong:developfrom
abhijeet117:fix/unit-array-multiply-overloads

Conversation

@abhijeet117

Copy link
Copy Markdown

Summary

multiply and dotMultiply support multiplying a Unit by an array of numbers at runtime (each entry scales the unit), but no declared overload expressed it: multiply(unit, array) fell through to the MathType catch-all and dotMultiply(unit, array) resolved to the generic collection overload returning the array's own element type. This adds Unit x MathNumericType[] overloads in both argument orders returning Unit[], matching the runtime result.

Testing

A scratch file calling all four forms (multiply/dotMultiply with the unit on either side) failed tsc --strict before the change with "Type 'MathType' is not assignable to type 'Unit[]'" and "'number[]' is not assignable to type 'Unit[]'", and compiles cleanly after. Runtime behavior is unchanged; the outputs match the examples in #3660. eslint passes on types/index.d.ts.

Checklist

  • bug reproduced before fix
  • root cause identified
  • bug fixed
  • tests passed

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@abhijeet117