A typescript language service plugin that gives superpowers to SQL tagged template literals.
TypeScript
319
94 commits
updated Jun 25, 2026
A typescript language service plugin that gives superpowers to SQL tagged template literals. Specifically aimed at the MySQL syntax.

Step 1: Yarn.
yarn add --dev ts-mysql-plugin
Step 2: TS Config.
Add the plugin to your compiler options in tsconfig.json. Note that databaseUri is optional, but recommended.
{
"compilerOptions": {
"plugins": [
{
"name": "ts-mysql-plugin",
"databaseUri": "mysql://USER@HOST/DB_NAME"
}
]
}
}
You can also optionally configure the MySQL version for the plugin to use (defaults to 5.7.12) This will ensure that the MySQL parser correctly notifies you about syntax errors for your version.
{
"mySQLVersion": "5.7.12"
}
You can also optionally override the default tags ("SQL" and "sql") by adding a "tags" array to the config. For example, if you want the plugin to activate only on "Sql" tags:
{
"tags": ["Sql"]
}
If you add @ts-mysql-plugin ignore in a comment at the top of a file, then the plugin will skip the file.
Run the following:
yarn install
yarn build
Assuming you've run all the steps in the "Development" section, then run the following:
cd e2e
yarn install
docker-compose up -d
cd ..
yarn test
TypeScript
100.0%
A typescript language service plugin that gives superpowers to SQL tagged template literals.
TypeScript
319
94 commits
updated Jun 25, 2026
A typescript language service plugin that gives superpowers to SQL tagged template literals. Specifically aimed at the MySQL syntax.

Step 1: Yarn.
yarn add --dev ts-mysql-plugin
Step 2: TS Config.
Add the plugin to your compiler options in tsconfig.json. Note that databaseUri is optional, but recommended.
{
"compilerOptions": {
"plugins": [
{
"name": "ts-mysql-plugin",
"databaseUri": "mysql://USER@HOST/DB_NAME"
}
]
}
}
You can also optionally configure the MySQL version for the plugin to use (defaults to 5.7.12) This will ensure that the MySQL parser correctly notifies you about syntax errors for your version.
{
"mySQLVersion": "5.7.12"
}
You can also optionally override the default tags ("SQL" and "sql") by adding a "tags" array to the config. For example, if you want the plugin to activate only on "Sql" tags:
{
"tags": ["Sql"]
}
If you add @ts-mysql-plugin ignore in a comment at the top of a file, then the plugin will skip the file.
Run the following:
yarn install
yarn build
Assuming you've run all the steps in the "Development" section, then run the following:
cd e2e
yarn install
docker-compose up -d
cd ..
yarn test
TypeScript
100.0%