Skip to main content
Hero Light

Complete NumPy for TypeScript

The most comprehensive NumPy implementation for TypeScript and JavaScript. Write numerical computing code with the same API you already know from Python — fully type-safe, tree-shakeable, and validated against NumPy itself.
npm install numpy-ts

Why numpy-ts?

94% API Coverage

476 of 507 NumPy functions implemented. From basic arithmetic to FFT, linear algebra, random distributions, and beyond.

Type-Safe

Full TypeScript type definitions for every function, dtype, and array operation. Catch errors at compile time, not runtime.

Tree-Shakeable

Import only what you need. Bundlers eliminate unused code automatically, keeping your production builds small.

NumPy-Validated

Over 6,000 tests compare outputs directly against NumPy. If NumPy produces a result, numpy-ts matches it.

Zero Dependencies

No native modules, no WebAssembly, no heavy runtimes. Pure TypeScript that runs everywhere JavaScript runs.

Universal Runtime

Works in Node.js, Bun, Deno, and all modern browsers. One library for server and client.

Quick Example

import { array, zeros, dot, linalg, arange, reshape } from 'numpy-ts';

// Create arrays -- just like NumPy
const a = array([[1, 2], [3, 4]]);
const b = zeros([2, 2]);

// Broadcasting works as expected
const c = a.add(1);        // [[2, 3], [4, 5]]
const d = a.multiply(2);   // [[2, 4], [6, 8]]

// Linear algebra
const inv = linalg.inv(a);
const det = linalg.det(a); // -2

// Dot products and matrix multiplication
const e = dot(a, array([[5, 6], [7, 8]]));  // [[19, 22], [43, 50]]

// Reshape, slice, and manipulate
const r = arange(12);
const grid = reshape(r, [3, 4]);

Get Started

Quickstart

Install numpy-ts and write your first array operations in under 5 minutes.

API Reference

Browse all 476 implemented functions with signatures, parameters, and examples.

Examples

Real-world examples covering linear algebra, signal processing, statistics, and more.

Playground

Write and run numpy-ts code directly in your browser with instant feedback.

Coming from NumPy?

numpy-ts mirrors the NumPy API as closely as possible. Most code translates directly:
import numpy as np

a = np.array([[1, 2], [3, 4]])
b = np.linalg.inv(a)
c = np.dot(a, b)          # identity matrix
d = np.sum(a, axis=0)     # [4, 6]
e = a[0, :]               # [1, 2]
See the NumPy Migration Guide for a complete translation reference.