introspect-it is a CLI and library for converting PostgreSQL database schemas into TypeScript type definitions. Current stable version is 3.0.0. It focuses on simplicity and zero-configuration: given a Postgres connection string, it automatically infers tables and columns, generating TypeScript types with proper nullability and date handling. Inline enums are supported, but namespaces are not. It is inspired by schemats but simpler and Postgres-only. The library exports `inferSchema` and `inferTable` functions for programmatic use. Releases are infrequent but stable. Compared to alternatives like schemats or pg-to-ts, it requires no configuration files and produces concise output.
npm install introspect-itNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Programmatic usage of introspect-it: connect to a Postgres database and generate TypeScript types for the entire public schema.
Update imports to use named exports: import { inferSchema, inferTable } from 'introspect-it'Use 'npx introspec-it' instead of 'npx introspect-it'.
Ensure your database is PostgreSQL before using introspect-it.
Append '?currentSchema=public' (or your schema name) to the connection string.
Install the package: npm install introspect-it
Check the table name and schema: ensure it exists and is spelled correctly, including the currentSchema parameter.
Run npm install introspect-it@latest to get the latest version.