Found an issue in iteration functions like map and forEach, when a callback function has only one signature only its signature is mapped, but the signature doesn't have the logic to reject and covert types.
const fn = math.typed({number: x => x + 1})
math.map([1, 2], fn) // yields [2, 3]
math.map([1, 'text'], fn) // yields [2, 'text1']
// should be TypeError: Function map cannot apply callback arguments to function : Cannot convert "text" to a number
The issue was introduced by #3256
It should be possible to still use the signature only for matrices that have a datatype that is not "mixed" or undefined
I'm willing to work on the fix, might have an effect on performance but have more precise results.
Found an issue in iteration functions like
mapandforEach, when a callback function has only one signature only its signature is mapped, but the signature doesn't have the logic to reject and covert types.The issue was introduced by #3256
It should be possible to still use the signature only for matrices that have a datatype that is not
"mixed"orundefinedI'm willing to work on the fix, might have an effect on performance but have more precise results.