gitwtfhub

wtf is numtype?

crankfunk/numtype — explained in plain English

Analysis updated 2026-05-18

1TypeScriptAudience · developerComplexity · 3/5LicenseSetup · easy

TL;DR

A TypeScript library for numeric arrays that catches shape mismatches as editor errors while you type, instead of at runtime.

Mindmap

mindmap
  root((numtype))
    What it does
      NumPy-like arrays
      Compile-time shape checks
      Editor errors while typing
    Tech stack
      TypeScript
      Rust
      WebAssembly
    Use cases
      Catch matmul mismatches
      Numeric array code
      Browser-safe execution
    Audience
      TypeScript developers
      Numeric code authors
    Status
      v0.2 research preview
      Apache-2.0 license

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Catch array shape mismatches like a bad matrix multiply as a compile-time error instead of a runtime crash.

REASON 2

Build numeric or tensor-style code in TypeScript with NumPy-like array operations.

REASON 3

Get instant hover and error feedback in any TypeScript-aware editor with no extra plugin.

REASON 4

Run numeric array code safely in the browser using the pure JavaScript backend.

What's in the stack?

TypeScriptRustWebAssembly

How it stacks up

crankfunk/numtype0xkinno/neuralvault0xmayurrr/ai-contractauditor
Stars111
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasyhardeasy
Complexity3/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Zero runtime dependencies, requires a fairly current TypeScript compiler for the type-level features.

Use freely for any purpose, including commercial use, as long as you keep the copyright and license notice.

Wtf does this do

numtype brings the idea behind NumPy, the popular Python library for working with grids of numbers, into TypeScript. The twist is that it checks the shapes of those grids while you are still typing your code, not after you run it. If you try to multiply two arrays whose shapes do not fit together, your editor shows an error right away instead of letting the mistake reach production. Many JavaScript and TypeScript projects that deal with numeric arrays have had to work around a missing piece: there was no shared, typed foundation for n-dimensional arrays the way NumPy is for Python. Related tools exist, but none of them put the type system itself to work checking array shapes. numtype focuses specifically on that gap, offering a smaller set of operations than a full NumPy clone would, done carefully rather than broadly. The technical trick is clever: TypeScript's type checker was never designed to do arithmetic on large numbers efficiently, so numtype represents numbers as strings of digits and does the math digit by digit, similar to how a person does subtraction by hand. This lets it compute things like array slice lengths and catch out of bounds errors directly in the type system, without needing huge amounts of computation that would normally overwhelm the checker. Under the hood, the actual number crunching is handled by a numeric backend written from scratch in Rust and compiled to WebAssembly, though this is optional. By default it runs on a pure JavaScript backend with zero runtime dependencies, so it works safely in a browser without any extra installation. The type-checking part works immediately in any modern code editor that understands TypeScript, with no special plugin needed. This project is aimed at TypeScript developers who work with numeric or array-heavy code and want mistakes caught early, before the program ever runs. It is licensed under Apache-2.0, which is a permissive open license. The project describes itself as an early v0.2 research preview, so some rough edges are expected. The full README is longer than what was shown.

Yoink these prompts

Prompt 1
Show me how to create an NDArray in numtype and multiply two arrays with matmul.
Prompt 2
Explain why numtype reports a compile-time shape error for a mismatched matmul call.
Prompt 3
Help me install numtype and confirm the WASM backend is optional in my project.
Prompt 4
Write a small numtype example that slices an array and shows the computed shape in my editor.
Prompt 5
Compare using numtype versus a full NumPy-style port for my TypeScript project.

Frequently asked questions

wtf is numtype?

A TypeScript library for numeric arrays that catches shape mismatches as editor errors while you type, instead of at runtime.

What language is numtype written in?

Mainly TypeScript. The stack also includes TypeScript, Rust, WebAssembly.

What license does numtype use?

Use freely for any purpose, including commercial use, as long as you keep the copyright and license notice.

How hard is numtype to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is numtype for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.