TypeSQL generates type-safe TypeScript APIs from raw SQL statements. Version 0.24.0 is current. Release cadence is irregular, with frequent minor updates. Key differentiators: no ORM required, infers parameter/column types and nullability, supports dynamic ORDER BY, and works with PostgreSQL, MySQL, SQLite, LibSQL, and Cloudflare D1. The CLI tool scans SQL files and produces typed query functions, reducing boilerplate and runtime errors.
npm install typesql-cliNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates installation, configuration, SQL file creation, code generation, and usage of a typed query function.
Add "type": "module" to package.json or rename generated .ts files to .mts and use dynamic import.
Remove `authToken` from config and use database URI with credentials or env vars (`${DB_USER}`).Update typesql.json: replace "includeCrudTables": [] with "crudTables": [] and list table names explicitly.
Ensure database is accessible with the URI provided in typesql.json. For SQLite, the file must exist.
Add a build script like `"generate": "typesql generate"` and run it manually or via a watcher (e.g., nodemon).
Install all dependencies locally: `npm install typesql-cli typesql-core` or use `npx` to run the global CLI.
Check databaseUri in typesql.json. Ensure database server is running and accessible.
Run `typesql generate` after creating/editing SQL files. Use named import matching the file name (camelCase).
Add "type": "module" to package.json, or rename generated .js file to .mjs.