What does HackerNews think of ts-sql?

A SQL database implemented purely in TypeScript type annotations.

Language: TypeScript

#9 in SQL
#8 in TypeScript
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" }];
Which allows for things like this type that implements a simplified SQL query parser checked against a provided 'database' object:

https://github.com/codemix/ts-sql

This project was my go-to "nifty but pointless" example for TS string literal types before this article :)

author of ts-sql[0] here, this looks great (and a way more practical approach!)

[0] https://github.com/codemix/ts-sql

Another example, SQL-database-in-the-typescript-typesystem here https://github.com/codemix/ts-sql

This would have been much easier if I'd had ts-regexp at the time :)

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" }];
Someone claimed the type system of typescript is turning complete. This example shows how to derive types from string based sql statement: https://github.com/codemix/ts-sql
Yes, this currently exists in 4.1, unless I somehow misunderstand you. I’ve been making heavy use of it with the beta, it’s extremely useful.

Edit: see this SQL made out of the type system: https://github.com/codemix/ts-sql

if this can be used to make a type checker for SQL strings like https://github.com/MedFlyt/mfsqlchecker or https://github.com/codemix/ts-sql but for C# I will be stoked!
Inspired by ts-sql (https://github.com/codemix/ts-sql) and json-parser-in-typescript-very-bad-idea-please-dont-use (https://github.com/jamiebuilds/json-parser-in-typescript-ver...) I decided to try writing a tic tac toe ai in typescripts type system. Mainly as a way to get exposure to more complex typing. It's not as clean or impressive as these other implementations but I learned a lot building it!

Massive shout out to Barld Boot who's tic tac toe implementation I based this off! https://medium.com/@bakeds/play-tic-tac-toe-with-the-help-of...