Registry / devops / ts-mysql-plugin

ts-mysql-plugin

JSON →
library1.0.1jsnpmunverified

A TypeScript language service plugin that enhances SQL tagged template literals with autocomplete, hover documentation, and diagnostics for MySQL syntax. Works with table and column names from a database schema to provide type-checking and error detection. Compatible with TypeScript 2.3+, integrated into editors that support TS plugins (VS Code, Sublime Text, Atom). Version 1.0.1 is the latest, with no recent updates; the project appears stable but low maintenance. Alternatives include general SQL plugins like sql-formatter or other database-specific TS plugins.

npm install ts-mysql-plugin
INSTALL
IMPORT
SIG · TS-MYSQL-PLUGIN
T
ts-mysql-plugin
devopsjavascriptv1.0.1
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
Add to tsconfig.json under compilerOptions.plugins
import or require() the plugin
This is a TS language service plugin, not directly imported. Configure in tsconfig.json.

Shows setup in tsconfig.json and usage with SQL tagged template literal. Basic configuration with database URI and custom tags.

// In tsconfig.json: { "compilerOptions": { "plugins": [ { "name": "ts-mysql-plugin", "databaseUri": "mysql://user:pass@localhost/mydb", "tags": ["SQL", "sql"] } ] } } // Usage in .ts files: const sql = SQL`SELECT * FROM users WHERE id = ${userId}`; // The plugin provides autocomplete, hover info, and type checking for SQL syntax and schema.
Debug
Known issues
gotchaPlugin requires TypeScript 2.3+ and must be configured in tsconfig.json. Direct import will not work.
fix
Add to tsconfig.json plugins array, not import.
affects: >=0
gotchaThe plugin activates only on template literals tagged with the configured tags (default 'SQL' or 'sql'). If using custom tags, ensure they are listed.
fix
Add 'tags' array with the exact tag names used in your code.
affects: >=0
gotchaDatabase connection string (databaseUri) is optional but without it schema-based features (table/column autocomplete, diagnostics) won't work.
fix
Provide a valid MySQL connection URI or disable schema features.
affects: >=0
deprecatedThe plugin may not be actively maintained; last release was 1.0.1 and it may not support latest TypeScript versions.
fix
Check compatibility with your TypeScript version or consider alternatives.
affects: >=1.0.1
Errors
Common errors & fixes
Cannot find module 'ts-mysql-plugin'
The plugin is not installed or tsconfig.json path is incorrect.
fix
Run 'yarn add --dev ts-mysql-plugin' or 'npm install --save-dev ts-mysql-plugin' and ensure tsconfig.json is in the project root.
No diagnostics for SQL syntax errors
Plugin not activated because tag name is not recognized (default: SQL or sql) or file is ignored via comment.
fix
Check that template literal uses exact tag 'SQL' or 'sql', or configure custom tags in tsconfig. Remove '@ts-mysql-plugin ignore' comment if present.
TypeScript language service plugin not loading
TypeScript version mismatch or plugin not in tsconfig.json correctly.
fix
Ensure TypeScript >= 2.3, and that tsconfig.json has 'compilerOptions.plugins' with name 'ts-mysql-plugin'.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
ts-mysql-plugin — npm install ts-mysql-plugin · libregistry