Registry / database / typescript-sql-tagged-template-plugin

typescript-sql-tagged-template-plugin

JSON →
library0.3.0jsnpmunverified

A TypeScript language service plugin that adds type checking and syntax error detection for SQL queries written inside tagged template literals. Currently supports PostgreSQL only. Version 0.3.0 provides diagnostics, type checking against a user-supplied database schema file, and formatting via pgFormatter (requires Perl). It is configured in tsconfig.json and works in any editor with TypeScript language server plugin support. The plugin is maintained and updated infrequently; it is a specialized tool for developers using raw SQL strings in TypeScript.

npm install typescript-sql-tagged-template-plugin
INSTALL
IMPORT
SIG · TYPESCRIPT-SQL-TAG
T
typescript-sql-tagged-template-plugin
databasejavascriptv0.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Plugin
No direct import needed; configure in tsconfig.json plugins array
This is a language service plugin, not a runtime module. It is loaded by the TypeScript language server via settings.

Shows installation, tsconfig configuration, and a basic SQL tagged template usage that the plugin analyzes.

// Ensure TypeScript is installed in your project npm install --save-dev typescript typescript-sql-tagged-template-plugin // tsconfig.json { "compilerOptions": { "plugins": [{ "name": "typescript-sql-tagged-template-plugin", "schemaFile": "./path/to/database-schema.json" }] } } // Example SQL tagged template (requires a custom sql tag function) import { sql } from 'some-sql-tag-library'; const query = sql`SELECT * FROM users WHERE id = ${userId}`;
Debug
Known issues
gotchaVS Code uses a separate syntax server that does not load tsconfig plugins by default, breaking formatting features.
fix
Disable the 'TypeScript > Tsserver: Use Separate Syntax Server' setting in VS Code.
affects: >=0.1.0
deprecatedThe plugin only supports PostgreSQL. Other SQL dialects like MySQL, SQLite are not checked.
fix
Ensure you are using PostgreSQL syntax; for other databases, find alternative plugins.
affects: *
gotchaSchema file is required for type checking; without it, only basic syntax errors are reported.
fix
Generate a database schema JSON file using the provided script (scripts/schema/index.js) and configure 'schemaFile' in tsconfig.
affects: >=0.1.0
gotchaFormatting only works if Perl is installed on the system, as it uses pgFormatter which depends on Perl.
fix
Install Perl or disable formatting via 'enableFormat': false.
affects: *
Errors
Common errors & fixes
Plugin 'typescript-sql-tagged-template-plugin' is not found
The plugin is not installed or not referenced correctly in tsconfig.json.
fix
Run 'npm install --save-dev typescript-sql-tagged-template-plugin' and ensure 'name' matches exactly.
Cannot find name 'sql'
The sql tag function needs to be imported from a third-party library; this plugin does not provide it.
fix
Install and import an sql tag library like 'sql-tagged-template-literal' or define your own.
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies
typescriptrequiredpeer dependency; works as a language service plugin, requires TypeScript to be installed
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
1
Resources
typescript-sql-tagged-template-plugin — npm install typescript-sql-tagged-template-plugin · libregistry