Sample Conversion: SQL DDL → TypeScript Interfaces
Input (SQL DDL)
CREATE TABLE customers (
id INT PRIMARY KEY,
email VARCHAR(255) NOT NULL,
phone VARCHAR(20),
balance NUMERIC(12,2) NOT NULL
); Output (TypeScript Interfaces)
export interface Customer {
id: number;
email: string;
phone?: string | null;
balance: number;
} Frequently Asked Questions
Are nullable columns represented as optional in TypeScript?
Yes, columns without a NOT NULL constraint are generated as optional (? : type | null).