HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
codemix
ts-sql
TypeScript2020–2024
codemix / ts-sql

ts-sql

A SQL database implemented purely in TypeScript type annotations.

17Distinct people
22Mentions
0Explicit recommenders
3.3KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A SQL database implemented purely in TypeScript type annotations.

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 11:56:56 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year22 dated mentions

Observed mentions: 2020-09-21 21:27:01 UTC to 2024-11-02 23:17:10 UTC.

02462020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 7 mentions; 2 submissions, 5 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2024

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC725
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC505
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC303
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC303
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC404

What Hacker News says

22 sources
TypeScript's type system is Turing complete, so you can not only do that, but also some insane stuff like: - A SQL database implemented purely in TypeScript type system (https://github.com/codemix/ts-sql) - Chess implemented entirely in TypeScript (and Rust) type systems (https://github.com/Dragon-Hatcher/type-system-chess) - Lambda calculus in TypeScript type system (https://ayazhafiz.com/articles/21/typescript-type-system-lam...)
In Cash: A small jQuery alternative for modern browsers
There is an implementation of SQL that operates on a table shaped type, entirely at type level. For your amusement: https://github.com/codemix/ts-sql There are a bunch of more practical takes that codegen types from your database and generate types for your queries, eg: https://github.com/adelsz/pgtyped To me the second approach seems much more pragmatic because you don’t need to run a SQL parser in your typechecker interpreter on every build
In Type-Safe Printf() in TypeScript
> If I would level criticisms at dialyzer it would be its sometimes difficult to read warnings, it’s speed (despite being multithreaded) and the race conditions in the VS Code plugin (which is looking for extra maintainers – if I had time I would help). One of the advantages of TypeScript is that VSCode is written in TypeScript, and both VSCode and TypeScript are developed by the same company, so there's a really nice synergy there. I imagine Kotlin users feel the same way using Jetbrains products, and Swift users feel the same way about XCode. Dialyzer looks interesting, but I can't imagine giving up on the expressiveness of TypeScript. Some of the things you can do with generics, mapped types, intersection types, template literal types, conditional types, and utility types are almost mind boggling. It's difficult to reap all of the bene
Read the rest
fits of static analysis without some of these advanced type operators. The type manipulation section of the TS manual is really underrated. Someone for example wrote an SQL parser in TypeScript that requires no runtime code [1]. It can infer the types of an SQL query's result based on an SQL string without any runtime code execution. There was a similar project where someone built a JSON parser entirely using the type system [2]. There's also an ongoing discussion on Github about the the fact that TypeScript's type system appears to be a Turing-complete language with some other cool examples [3]. My point is that the type system is incredibly expressive. You rarely run into an idiom that can't be typed effectively. [1] https://github.com/codemix/ts-sql [2] https://twitter.com/buildsghost/status/1301976526603206657 [3] https://github.com/microsoft/TypeScript/issues/14833
In How to sell Elixir again
If you want to see some more legs on TypeScript type-level logic, check out this SQL database as Typescript types: https://github.com/codemix/ts-sql: import { Query } from "@codemix/ts-sql"; const db = { things: [ { id: 1, name: "a", active: true }, { id: 2, name: "b", active: false }, { id: 3, name: "c", active: true }, ], } as const; type ActiveThings = Query< "SELECT id, name AS nom FROM things WHERE active = true", typeof db >; // ActiveThings is now equal to the following type: type Expected = [{ id: 1; nom: "a" }, { id: 3; nom: "c" }];
In TypeScripting the technical interview
Here you go! https://github.com/codemix/ts-sql import { Query } from "@codemix/ts-sql"; const db = { things: [ { id: 1, name: "a", active: true }, { id: 2, name: "b", active: false }, { id: 3, name: "c", active: true }, ], } as const; type ActiveThings = Query< "SELECT id, name AS nom FROM things WHERE active = true", typeof db >; // ActiveThings is now equal to the following type: type Expected = [{ id: 1; nom: "a" }, { id: 3; nom: "c" }];
In Postgres to TypeScript Interfaces and Enums

Showing the 15 most recent of 22 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.