Improve on TypeScript definitions to relfect support for multiple data types
Can't one create a matrix of custom elements, e.g. objects, like {type:'something'}? I noticed that only numbers are supported
Matrices can contain elements of any type, even mixed together. Can you explain what you mean exactly?
I use typescript and mathjs does not allow me to use anything else than number[][]. Same for .map and .forEach.

Here I can see that data param is declared as Matrix | MathArray but I do not know how to use Matrix (is it something internal?). In examples I saw only any[][] usage. https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/mathjs/index.d.ts#L239
Here I try to use .map on matrix, type definitions do not allow me to do it:
Typescript think that I returning Unit here because I returning an object (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/mathjs/index.d.ts#L30)
Seems one can do const map = mathjs.map(zeros2d, (val, [x, y]) => (({} as unknown) as any)) and it will work but typescript will think that map is still a number[] | number[][] | mathjs.Matrix
So it is a problem with type definitions
Would be great to improve the TypeScript definitions so you know that you actually have much more power :)
Is there anyone who can help out on improving the TS definitions?
I've raised a new issue and hours later find this one (didn't searched the correct key words).
I suggest to modify the @types/mathjs/index.d.ts on line 24
type MathArray = Number[] | Number[][];
to
type MathArray = MathType[] | MathType[][];
I've also noticed another potential typo on line 2974:
valueOff(): MathArray | Matrix;
should be
valueOf(): MathArray | Matrix;
Related: #1828. Would be nice to fix this in one go as well.
The isConditionalNode attribute of MathNode is wrongly spelled isConditionalnode in @types/mathjs
Anyone able to create a PR with fixes for the TypeScript definitions?
I made this change https://github.com/DefinitelyTyped/DefinitelyTyped/pull/45289 , however it's creating a new issue where there is a circular reference between the MathType and MathArray types -- which causes the linter to throw. Any suggestions?
Type alias 'MathType' circularly references itself.
Thanks Jason for picking this up! Maybe it's possible to define a MathScalar type, which is all types like number and Unit, except matrix types?