🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

knex-types

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knex-types

Generates TypeScript definitions (types) from a (PostgreSQL) database schema.

latest
Source
npmnpm
Version
0.5.0
Version published
Maintainers
1
Created
Source

Knex.js types generator

NPM Version NPM Downloads TypeScript Donate Discord

An utility module for Knex.js that generates TypeScript definitions (types) from a PostgreSQL database schema.

$ npm install knex
$ npm install knex-types --dev

Usage Example

const { knex } = require("knex");
const { updateTypes } = require("knex-types");

const db = knex(require("./knexfile"));

updateTypes(db, { output: "./types.ts" }).catch((err) => {
  console.error(err);
  process.exit(1);
});

Find an example of generated types in ./main.test.ts.

  • GraphQL API Starter Kit — monorepo template, pre-configured with TypeScript, GraphQL.js, React, and Relay
  • Node.js API Starter Kit — Node.js project template (PostgreSQL, Knex, OAuth 2.0, emails, Cloud Functions)

How to Contribute

Please create a PR or send me a message on Discord.

License

Copyright © 2021-present Kriasoft. This source code is licensed under the MIT license found in the LICENSE file.

Made with ♥ by Konstantin Tarkus (@koistya, blog) and contributors.

Keywords

database

FAQs

Package last updated on 02 Dec 2022

Did you know?

Socket

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.

Install

Related posts