
Product
A New Overview in our Dashboard
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
MSSQL TS
is a TypeScript generator tool for converting Microsoft SQL Server (MSSQL) database schemas into TypeScript interfaces. This tool is designed to automate the process of creating TypeScript types based on your database structure, making it easier to work with MSSQL databases in TypeScript projects.
To start using MSSQL TS, simply install the package, configure it to connect to your MSSQL database, and run the generator.
To install MSSQL TS
, you need to have Node.js installed on your system. Once Node.js is installed, you can install MSSQL TS
using npm:
npm i mssql-ts -D
# Or Yarn
yarn add mssql-ts --dev
# Or pnpm
pnpm add mssql-ts -D
import { generator } from "mssql-ts";
generator({
config: {
client: "mssql",
connection: {
host: "localhost",
user: "username",
password: "password",
database: "my_db"
},
},
capitalizeTypes: true,
path: `${__dirname}/src`,
customFileName: "MSSQLTypes"
});
The generator function accepts a configuration object with the following properties:
For more detailed configuration settings and options, see the Knex.js documentation.
To generate the TypeScript interfaces from your MSSQL database schema, you can use the following script command in your project's package.json file:
"scripts": {
"mssql-ts-generate": "<ts-node || tsx> main.ts"
}
Replace <ts-node || tsx>
with ts-node if you are using standard TypeScript files, or tsx if you are using TypeScript with React JSX syntax. Ensure that main.ts is correctly pointing to your script file that contains the generator function call.
MSSQL TS is perfect for developers and teams working on TypeScript applications that interact with MSSQL databases. Whether you're building enterprise-level applications, working on a personal project, or anywhere in between, this tool can significantly streamline your development process.
FAQs
Generate Types from your Microsoft SQL Database
The npm package mssql-ts receives a total of 6 weekly downloads. As such, mssql-ts popularity was classified as not popular.
We found that mssql-ts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.