186 Commits

Author SHA1 Message Date
Ayomide Bamigbade
6545dcd7c5
fix: #3597 added nullish type definitions (#3601) 2025-11-26 10:06:55 +01:00
NilsDietrich
48ba6adbca
feat: support for optional chaining object?.key (#3547) 2025-10-29 11:07:52 +01:00
Glen Whitney
faf249b6c0
feature: add function bernoulli to calculate Bernoulli numbers (#3551) 2025-10-29 10:47:11 +01:00
Glen Whitney
9ee2a00877
feat: implement functions isFinite and isBounded (#3554) 2025-10-18 13:17:14 +02:00
Josh Kelley
f0ae0f3741
fix: add missing type definitions for ctranspose (#3545) 2025-10-01 11:57:16 +02:00
Josh Kelley
4ec99fc022
fix: typos in code comments (#3544) 2025-10-01 11:50:17 +02:00
Josh Kelley
963476019a
fix: type definition of abs(complex) (#3543)
The absolute value of a complex number is a plain number.
2025-10-01 11:45:48 +02:00
DongKwanKho
df8d098e82
fix: add missing type definition for function diff (#3520). Thanks @dodokw. 2025-09-02 11:00:18 +02:00
Jos de Jong
2e078211af chore: remove dtslint (this package has been deprecated) 2025-09-02 10:55:15 +02:00
Jos de Jong
0e9d818a8f fix #3517: printTransformDependencies not exported in the type definitions 2025-08-28 16:14:24 +02:00
Jacopo Mercolini
8d19c8b51e
feat: toBest(unit, unitList, offset) function (#3484)
* feat: toBest tests

* feat: toBest function initial

* fix: tests and function changes

* fix: dependencies

* new way to handle

* updated tests

* test updated

* tests fixed

* cleaned useless tests

* cleaned useless condition

* fix: missing comments

* fix: moved tests

* other fix and clean

* change test to work with npx mocha "path" -g "toBest"

* deleted check large and small value

* deleted precision test and fix options to bestprefix

* fix: moved toBest tests in correct file

* fix: math create

* fix: aligned files pre-mr

* fix: toBest docs test

* fix: lint issues

* fix: comments

* fix: added a helper function to simplify the test readability

* fix: unit.md and units.md docs updated

* fix: test on units.length

* added post process denormalize for tobest function to string returned value

* removed this.clone into format

* feat improve incompatible units test

* fix assign prefixes

* fixed examples

* changed order of params of assertUnit

* fixed comments and added toBest in knowProblems at doc.test

* refactor: update toBest functionality and adjust related tests for accuracy

* refactor: remove unnecessary offset initialization in prefix application

---------

Co-authored-by: Luca Quercetti <l.quercetti@wecodeyou.it>
Co-authored-by: Elia Alesiani <elia.alesiani@gmail.com>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
Co-authored-by: lucaQ <lucaquercetti@gmail.com>
Co-authored-by: EliaAlesiani <105418798+EliaAlesiani@users.noreply.github.com>
2025-07-09 19:16:47 +02:00
mrft
09f6da9278
fix: #3493 #3499 #3494 type definitions of unit(number), for add and multiply without arguments, and for unit.to(unit) (#3495)
* fixes #3493 allowing math.unit(5), which would now fail because for values of MathNumericType and MathCollection, the second parameter wasn't optional

* Added tests, and as a result of that, fixed the definition of unit(value: MathCollection): Unit[] where no units seem to be allowed

* Changes as requested by josdejong

* math.add and math.multipl type fixes and added tests

* fixes #3494: math.unit(m).to(math.unit(cm)) is now ok for typescript
2025-07-02 10:37:44 +02:00
Jay Chang
d089378b77
fix: refine the type definitions of scope (#3490) 2025-06-11 17:17:24 +02:00
Rani D.
823d13e8f1
fix: #3469 add ResultSet interface and improve isResultSet typing (#3481)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-05-30 10:48:31 +02:00
Orel Ben Neriah
5c121f58de
fix: #3406 infer the correct type for D > 1 arrays in multiply function (#3408)
* fix: infer the correct type from two arrays defined as 2D

* chore: add check that 1D * 1D (number[]) arrays result in scalar

* chore: remove commented out line

* fix: update test so that 2D arrays can be multiplied correctly

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-02-27 12:34:47 +01:00
Christian Stussak
8359d408b6
fix: #3356 add missing eigsDependencies export to TypeScript definitions (#3397)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-02-20 14:30:07 +01:00
Glen Whitney
127ea626fc
feat: #3041, #3340 rename apply to mapSlices (#3357)
* chore: Rename `apply` to `mapSlices`

  This renaming conforms with the Julia name for the function formerly
  called `apply`, and allows it to be called from the expression parser.
  The previous name `apply` is kept as an alias for `mapSlices`, for
  backward compatibility. This commit implements an `alias` metadata
  property for function factories to facilitate the `apply` alias for
  `mapSlices`.

  As a separate bonus, this PR corrects several typos in function docs
  and removes now-passing doc tests from the list of "known failing" doc
  tests to get down to 45 known failures and 136 total issues in doc tests.
  (Most of the excess of 136 as compared to 45 are just due to roundoff
  error/slight inaccuracy of what the documentation claims the result will
  be and the actual result returned by mathjs. When the 45 are eliminated,
  a reasonable numeric tolerance can be decided on for doc testing and
  then the doc tests can be made binding rather than advisory.

* refactor: changes per PR review

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2025-01-30 13:19:23 +01:00
Glen Whitney
b56fbcb13e
fix: type definitions for matrixFrom* (#3371)
* Addressed silentmissile's comment in https://github.com/josdejong/mathjs/issues/3125

* Added method overload to index.d.ts, have to revert commit due to changes to package-lock.json with using npm install to run the unit tests & lint tests

* Type definition missing for matrixFrom* #3115

* fix: Update types and add tests as requested by review

* chore: lint fix

---------

Co-authored-by: Hudsxn <jhudson98new@gmail.com>
Co-authored-by: Hudsxn <143907857+Hudsxn@users.noreply.github.com>
2025-01-29 16:34:50 +01:00
Jos de Jong
9394b3cd3a chore: update devDependencies 2024-12-11 18:03:26 +01:00
Francois
97da410d30
fix: export Fraction type from the fraction.js library instead of using custom one (#3330)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-12-11 11:33:42 +01:00
Jos de Jong
e93780e6d5 Merge branch 'develop' into v14 2024-11-20 11:41:30 +01:00
Jos de Jong
67ddc724e1 fix: #3260 improve type definitions and documentation on the callback indices of map, filter, and forEach 2024-11-20 11:32:11 +01:00
Orel Ben Neriah
b10e3169c6
fix: #3098 updates MathArray types to be n-dimensional (#3306) 2024-11-07 08:44:03 +01:00
Jos de Jong
301d00e8a5
feat: upgrade to fraction.js@5 (#3312) 2024-11-06 17:25:31 +01:00
Jos de Jong
22db7d2df3 Revert "feat: upgrade to fraction.js@5 (#3283)"
This reverts commit 9b81230950b5bed113817dc4ec7803df7e51313e.
2024-11-06 17:14:16 +01:00
Jos de Jong
9b81230950
feat: upgrade to fraction.js@5 (#3283) 2024-11-06 17:08:26 +01:00
Orel Ben Neriah
9dca98b0c3
feat: adds unit support to ceil, floor, and fix functions (#3269)
BREAKING CHANGE:
The matrix types now support generics. For most practical cases, this doesn't cause a breaking change, but it is possible that it breaks typings in some specific edge cases.
2024-10-21 12:50:17 +02:00
Jos de Jong
4c64018a79 fix: #3246 add type definitions for function leafCount 2024-09-04 11:35:39 +02:00
Jos de Jong
8d244d2754 fix: #3259 revert the duplicate symbolicEqual definition and just export the existing definitions 2024-09-04 11:32:47 +02:00
Jos de Jong
4d91f10095 fix: #3259 function symbolicEqual missing in the TypeScript definitions 2024-09-04 11:06:21 +02:00
Brooks Smith
2e34c795e7
fix: improve the type definitions of ConstantNode to support all data types (#3257) 2024-08-28 17:15:00 +02:00
David Contreras
bcf0da46f0
feat: support multiple inputs in function map (#3228) 2024-08-22 13:35:21 +02:00
David Contreras
459ae13725
docs: spelling fixes in the embedded docs (#3252)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-08-21 14:30:40 +02:00
Jos de Jong
a1eec936fc
feat: export util functions for maps and improve documentation of scope (#3243)
* feat: export util functions `isMap`, `isPartitionedMap`, and `isObjectWrappingMap` and improve the documentation of `scope` (see #3150)

* chore: fix broken unit tests

* docs: refine the explanation about scopes
2024-08-01 10:57:23 +02:00
Orel Ben Neriah
f5a5463b0d
fix: types static methods and members for Unit class (#3230)
* fix: types static method for Unit class

Changes unit interface to declare class to enable the adding of static methods.

* refactor: change to not using declare class

* fix: adds more unit static methods and updates tests

* chore: moves test from wrong location

* fix: adds additional static methods and updates jsDocs

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-07-11 13:26:50 +02:00
Jos de Jong
c118eaec90 fix: #3232 fix type definitions of function format to support notations hex, bin, and oct 2024-07-11 13:12:27 +02:00
Adam Jones
1db2ba6d3b
Further improve quantileSeq typings (#3223)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-06-28 12:15:09 +02:00
Orel Ben Neriah
3f6567a231
fix: #2348 update type definitions of the Parser methods (#3226)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-06-28 11:49:53 +02:00
Jos de Jong
ab3461d484
feat: implement support for bigint (#3207, #2737) 2024-05-31 12:43:09 +02:00
Jos de Jong
f5755e71dc Merge branch 'refs/heads/develop' into v13 2024-05-21 16:09:28 +02:00
Jos de Jong
ec9eb9f084 Merge remote-tracking branch 'origin/develop' into develop 2024-05-16 08:48:05 +02:00
Adam Jones
ffa3a2e20a
Improve quantileSeq typings (#3198)
* Improve quantileSeq typings

* Add tests, revert comment changes

* Fix type tests
2024-05-16 08:47:13 +02:00
Jos de Jong
49df88985e docs: document how to run tests for the type definitions 2024-05-16 08:46:58 +02:00
David Contreras
eded7e1dc3
feat: nearly equal with relative and absolute tolerance (#3152)
* nearlyEqual with absolute and relative tolerances

* Format

* nearlyEqual for bigNumber

* Added skip for NaN

* Reduce diff a bit

* Issue with examples in jsdcos

* Updated all calls for nearlyEqual

* Fixed failing tests

* Changed epsilon to relTol, absTol

* Changed references to epsilon in docs and tests

* Added warning for config.epsilon

* Fix warning in zeta.test

* Added config test

* Added sinon to test console.warn

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-05-15 10:56:11 +02:00
Jos de Jong
2e427ec3a9 fix: #3180 fix type definitions of function add and multiply to allow
more than two arguments
2024-04-03 09:27:12 +02:00
Rich Martinez
b78ac811a4
fix: mode signature return types (#3153)
* fix: mode type signatures

* Add ts tests for mode

* Add assertions mode type tests

* Update author Rich in AUTHORS file

---------

Co-authored-by: Rich Martinez <richmartinez@Edinas-MacBook-Pro.local>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-02-21 12:36:40 +01:00
Hudsxn
270559acf4
Improve type definitions of function hypot (#3144)
* Addressed silentmissile's comment in https://github.com/josdejong/mathjs/issues/3125

* Added method overload to index.d.ts, have to revert commit due to changes to package-lock.json with using npm install to run the unit tests & lint tests
2024-01-31 12:36:56 +01:00
Jos de Jong
c60f637a60 fix: #3142 support BigNumber values for the options of function format: precision, wordSize, lowerExp, upperExp 2024-01-31 10:58:42 +01:00
S.Y. Lee
e80681301a
Infer types of arguments more precisely (#3123)
* Prefer inferring types of nodes as tuples

* Implement for IndexNode

* Test for types

* Use tuple type for array node

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-01-15 09:43:28 +01:00
Jos de Jong
a1e5790546 chore: update devDependencies 2023-11-17 10:26:05 +01:00