Ejemplo de conversión: SQL DDL → Interfaces TypeScript
Entrada (SQL DDL)
CREATE TABLE customers (
id INT PRIMARY KEY,
email VARCHAR(255) NOT NULL,
phone VARCHAR(20),
balance NUMERIC(12,2) NOT NULL
); Salida (Interfaces TypeScript)
export interface Customer {
id: number;
email: string;
phone?: string | null;
balance: number;
} Preguntas frecuentes (FAQ)
¿Las columnas que permiten NULL se generan como opcionales en TypeScript?
Sí, las columnas sin restricción NOT NULL se generan automáticamente como propiedades opcionales (?: tipo | null).