Skip to main content
DevTools24

SQL to TypeScript

Convert SQL CREATE TABLE statements to TypeScript interfaces. Keep your types in sync with your database.

SQL to TypeScript Type Mapping:
INT/SERIAL → number
VARCHAR/TEXT → string
BOOLEAN → boolean
TIMESTAMP → Date
JSON/JSONB → Record
DECIMAL → number
UUID → string
BYTEA → Buffer

Database Type Safety - Détails techniques

Generating TypeScript types from SQL schemas ensures your application code matches your database structure. Column types are mapped to TypeScript equivalents, and NULL columns become optional properties.

Alternative en ligne de commande

-- SQL\nCREATE TABLE users (\n  id SERIAL PRIMARY KEY,\n  email VARCHAR(255) NOT NULL\n);\n\n// TypeScript\ninterface Users {\n  id: number;\n  email: string;\n}

Référence

Voir la spécification officielle