ADVERT
๐งฑ SQL to TypeScript
Paste SQL CREATE TABLE statements and generate TypeScript interfaces for your data models. Runs in your browser with no sign-up required.
SQL to TypeScript
Parse one or more CREATE TABLE statements into TypeScript models with diagnostics and relation hints.
Parsed table preview
users
| Column | SQL type | TS type | Required | References |
|---|---|---|---|---|
| id | SERIAL PRIMARY | number | Yes | - |
| name | VARCHAR(120) | string | Yes | - |
| VARCHAR(160) | string | Yes | - | |
| active | BOOLEAN DEFAULT | boolean | No | - |
| created_at | TIMESTAMP NOT | string | Yes | - |
| profile | JSONB | unknown | No | - |
| role | TEXT | string | No | - |
orders
| Column | SQL type | TS type | Required | References |
|---|---|---|---|---|
| id | BIGINT PRIMARY | number | Yes | - |
| user_id | INTEGER NOT | number | Yes | users |
| total | NUMERIC(10,2) | number | Yes | - |
| tags | TEXT[] | string[] | No | - |
| status | ENUM('pending','paid','failed') | 'pending' | 'paid' | 'failed' | Yes | - |
| created_at | TIMESTAMP NOT | string | Yes | - |
Diagnostics
No parse diagnostics.
How to use this tool
- Paste one or more CREATE TABLE statements.
- Review parsed columns and diagnostics in the preview table.
- Copy or download generated TypeScript declarations.
Parser behavior
- Supports multiple CREATE TABLE blocks in one pass.
- Maps precision and array types to practical TS equivalents.
- Carries REFERENCES hints into comments and preview columns.
Manual follow-up
- Adjust unknown/custom SQL types flagged in diagnostics.
- Refine enum unions when SQL dialects use custom patterns.
- Model join relations and derived views separately.
FAQ
- Does this support multiple tables?
- Yes. It parses multiple CREATE TABLE statements and emits one model per table.
- Are foreign keys represented?
- Reference targets are surfaced as hints and comments, not full ORM relations.
- What happens with unknown SQL types?
- They default to string and are listed in diagnostics so you can correct mappings manually.
ADVERT
ADVERT