API Reference
numpy-ts implements 476 out of 507 NumPy functions (93.9% coverage) in pure TypeScript with zero dependencies. Every function is tested against NumPy for correctness.Coverage by category
| Category | Functions | Status |
|---|---|---|
| NDArray Class & Methods | 47/47 | 100% |
| Array Creation | 35/35 | 100% |
| Arithmetic | 29/29 | 100% |
| Exponential & Logarithmic | 9/9 | 100% |
| Trigonometric | 16/16 | 100% |
| Hyperbolic | 9/9 | 100% |
| Rounding | 7/7 | 100% |
| Other Math | 15/15 | 100% |
| Array Manipulation | 46/46 | 100% |
| Reductions | 36/36 | 100% |
| Statistics | 11/11 | 100% |
| Linear Algebra | 38/38 | 100% |
| Logic & Comparison | 34/34 | 100% |
| Sorting & Searching | 13/13 | 100% |
| Set Operations | 12/12 | 100% |
| Bitwise | 13/13 | 100% |
| Indexing | 27/27 | 100% |
| Gradient & Differences | 3/3 | 100% |
| Polynomials | 10/10 | 100% |
| Random | 53/53 | 100% |
| FFT | 18/18 | 100% |
| I/O | 8/8 | 100% |
| Utilities | 26/26 | 100% |
| Unplanned | 0/31 | — |
How to read this reference
Each function page follows a consistent format: Signature — The full TypeScript signature with generics and overloads where applicable.| Parameter | Type | Default | Description |
|---|---|---|---|
a | NDArray | — | Input array. |
axis | number | undefined | Axis along which to operate. When undefined, operates on the flattened array. |
keepdims | boolean | false | If true, reduced axes are kept as dimensions with size 1. |
NDArray when reducing along a single axis).
Example — A short, runnable code snippet demonstrating typical usage.
All type signatures use the
NDArray class from the default numpy-ts entry point. If you use the tree-shakeable numpy-ts/core entry point, return types are NDArrayCore instead. The API is otherwise identical.Intentionally unplanned features
The following NumPy features are not implemented by design (31 functions):- Datetime types —
datetime64andtimedelta64dtypes. Use native JavaScriptDateor libraries likedate-fnsinstead. - Fortran-order layout —
order='F'parameter. All arrays use C-contiguous (row-major) layout. - Object dtype —
dtype=object. JavaScript does not have an equivalent concept. - String dtypes —
dtype='U'anddtype='S'. Use native JavaScript strings and typed arrays separately.
Quick links
NDArray Class
Properties, core methods, and the NDArray / NDArrayCore hierarchy.
NDArray Methods
100+ chainable instance methods on NDArray (arithmetic, reductions, shape, linalg, and more).
Array Creation
array, zeros, ones, arange, linspace, eye, and all *_like variants.
Linear Algebra
linalg.inv, linalg.det, linalg.eig, linalg.svd, linalg.solve, and more.
Random
53 random number generation functions including distributions and sampling.
FFT
Discrete Fourier transforms: fft, ifft, rfft, irfft, fft2, fftfreq, and more.