Merge pull request #30211 from appleparan/ap/fix-map-callback

[@types/mathjs] Fix wrong return type of callback of map function
This commit is contained in:
Daniel Rosenwasser
2018-11-01 14:26:29 -07:00
committed by GitHub
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -1345,7 +1345,7 @@ declare namespace math {
* the Matrix/array being traversed.
* @returns Transformed map of x
*/
map(x: Matrix | MathArray, callback: ((value: any, index: any, matrix: Matrix | MathArray) => Matrix | MathArray)): Matrix | MathArray;
map(x: Matrix | MathArray, callback: ((value: any, index: any, matrix: Matrix | MathArray) => MathType | string)): Matrix | MathArray;
/**
* Create a matrix filled with ones. The created matrix can have one or
+7
View File
@@ -270,6 +270,13 @@ Matrices examples
math.range('2:-1:-3');
math.factorial(math.range('1:6'));
}
// map matrix
{
math.map([1, 2, 3], function(value) {
return value * value;
}); // returns [1, 4, 9]
}
}
/*