josdejong/mathjs

Insufficient typing for `add`, `subtract`, `dotMultiply` etc

Aperta

#2349 aperta il 9 nov 2021

 (0 commenti) (3 reazioni) (0 assegnatari)JavaScript (1314 fork)batch import
help wantedtypescript

Metriche repository

Star
 (15.065 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

The functions

lack sufficiently fine-grained type definitions. In particular, this produces an error:

math.add([1, 2], [3, 4])[0];
// Element implicitly has an 'any' type because expression
// of type '0' can't be used to index type 'MathType'.
// Property '0' does not exist on type 'MathType'

while it should be clear that the result is a one-dimensional array.

Adding some overloads would make the TypeScript experience with Mathjs much smoother.

Guida contributor