Exemplo de conversão: 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
); Saída (Interfaces TypeScript)
export interface Customer {
id: number;
email: string;
phone?: string | null;
balance: number;
} Perguntas frequentes (FAQ)
Colunas que aceitam nulo ficam como opcionais no TypeScript?
Sim, colunas sem a restrição NOT NULL são geradas como propriedades opcionais (?: tipo | null) na interface TypeScript.