Skip to content

Commit

Permalink
add Matrix as a constructor type
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherChudzicki committed Mar 10, 2022
1 parent b5fa70f commit 1a7ba33
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ declare namespace math {
RelationalNode: RelationalNodeCtor;
SymbolNode: SymbolNodeCtor;

Matrix: MatrixCtor;

/**
* If null were to be included in this interface, it would be
* auto-suggested as an import in VSCode. This causes issues because
Expand Down Expand Up @@ -3248,6 +3250,10 @@ declare namespace math {
swapRows(i: number, j: number): Matrix;
}

interface MatrixCtor {
new(): Matrix;
}

interface BigNumber extends Decimal {} // tslint:disable-line no-empty-interface

interface Fraction {
Expand Down
8 changes: 8 additions & 0 deletions types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ Matrices examples
assert.deepStrictEqual(math.concat([[0, 1, 2]], [[1, 2, 3]]), [[ 0, 1, 2, 1, 2, 3 ]]);
assert.deepStrictEqual(math.concat([[0, 1, 2]], [[1, 2, 3]], 0), [[ 0, 1, 2 ], [ 1, 2, 3 ]]);
}

// Matrix is available as a constructor for instanceof checks
{
assert.strictEqual(math.matrix([1, 2, 3]) instanceof math.Matrix, true)
}
}

/*
Expand Down Expand Up @@ -640,6 +645,9 @@ Factory Test
assert. strictEqual(math.hasNumericValue(math.complex('2-4i')), false);
}

/**
* src/util/is functions
*/
{
const math = create(all, {});

Expand Down

0 comments on commit 1a7ba33

Please # to comment.