Skip to main content
DevTools24

SQL a TypeScript

SQL a tipi TypeScript.

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 - Dettagli tecnici

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.

Alternativa da riga di comando

-- 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}

Riferimento

Visualizza specifica ufficiale