TypeScript Language Service Plugin for SQL with a tagged template strings SQL builder.
TypeScript Language Service Plugin for SQL with a tagged template strings SQL builder.
TypeScript Language Service Plugin for SQL with a tagged template strings SQL builder. Inspired by andywer/squid
Install the plugin, run:
npm install ts-sql-plugin -DThen, configure the plugins section in your tsconfig.json:
…Note: If you're using Visual Studio Code, you'll have to use the first approach above, with a path to the module, or run the "TypeScript: Select TypeScript Version" command and choose "Use Workspace Version", or click the version number between "TypeScript" and in the lower-right corner. Otherwise, VS Code will not be able to find your plugin. See https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin#testing-locally
Install the plugin, run:
npm install ts-sql-plugin -gThen run:
ts-sql-plugin -p ./my_ts_project -c 'psql -U postgres -c'In the code below, some of the table names or column names are intentionally wrong. ts-sql-plugin will show you the errors.
…And there is a complete example using ts-sql-plugin and skm_ts in folder test_ts_sql_plugin.
You can use pgtyped tool for generating types from your emitted sql via directive:
/* ts-sql-plugin:emit("SomeInterface") */
/* @name SomeInterface */For generate types in realtime, use --watch option of cli.
https://marketplace.visualstudio.com/items?itemName=darky.vscode-ts-sql-plugin
No open issues yet, or sync has not completed.